Interfacing LCD Display with serial Interface like I2C can save microcontroller I/O making it a practical alternative to a standard parallel 8 bit interface. We’ll use PCF8574 I2C port expander and PIC16F876A microcontroller to establish IIC communication by 2 lines, SCL – Clock and SDA – Data. The disadvantage of this approach is that required code is a bit more complicated compared to a parallel interface. Here instead of sending 8 bits of command and data we’ll configure an LCD to operate in 4 bit mode and send two 4 bits nibbles. PCF8574 outputs are directly connected to LCD lines in the following way: D5 is R/S, D4 – EN and D3,D2,D1,D0 – Data. See design schematic for more details.
Parts of the design code were taken and modified from Interfacing HD44780 Character LCD Display and PCF8574 I2C 8-bit I/O expander posts. It’s probably not the most efficient implementation but it does the job of controlling the LCD display. 2×16 LCD module was used however the circuit can be upgraded for other display types. Design prototype board is shown below. Assembly code is available here.