Controlling an LCD device using serial I2C module
#define ON  1
#define OFF 0

//#define __LCD2__  // 2 row display
#define __LCD4__  // 4 row display

#ifdef __LCD2__
  #define LCD_MAX_LINES  2  // usually a 1602 2 X 16
  #define LCD_DISPLAY_WIDTH 16
  #define LCD_ID 0x4E       // I2C Base address for this interface
#endif

#ifdef __LCD4__
  #define LCD_MAX_LINES  4  // usually a J204A 4 X 20
  #define LCD_DISPLAY_WIDTH 20
  #define LCD_ID 0x40       // I2C Base address for this interface
#endif

#define RS          0b00000001  //P0 - PCF8574T Pin connected to RS
#define RW          0b00000010  //P1 - PCF8574T Pin connected to RW
#define EN          0b00000100  //P2 - PCF8574T Pin connected to EN
#define BACKLIGHT   0b00001000  //P3 - PCF8574T Pin connected to BACKLIGHT

#define LCD_LINE1   0x80        // LCD RAM address for line 1
#define LCD_LINE2   0xC0        // LCD RAM address for line 2
#define LCD_LINE3   0x94        // LCD RAM address for line 3
#define LCD_LINE4   0xD4        // LCD RAM address for line 4

int LcdBacklight = ON;

void InitLCD(void)
{
    printf("Initializing LCD...\r\n");

    delay_ms(500); //LCD power up delay

    LcdSendByte(0x00);
    LcdSendByte(0x10);
    LcdSendByte(0x00);
    LcdSendByte(0x00);
    LcdSendByte(0x10);

    //First state in 8 bit mode
    LcdSendByte(0x30);
    LcdSendByte(0x30);

    //Then set to 4-bit mode
    LcdSendByte(0x30);
    LcdSendByte(0x20);

    //mode 4 bit, 2 lines, characters 5 x 7
    LcdSendByte(0x20);
    LcdSendByte(0x80);

    //no need to have the cursor on. 
    //but if you want then '0Ch' is the addr
    LcdSendByte(0x00);
    LcdSendByte(0xC0);

    //the cursor moves to the left (06h)
    LcdSendByte(0x00);
    LcdSendByte(0x60);

    printf("LCD   Initialized...\r\n");
}