For 4 bit Data you have to make Bit Shifting to the Original 8 Data Lines Function,
Basically by the INSTRUCTIONS that are used for sending Data to LCD, are assumed to be sent over 8-Data Lines so when you make a function like
HTML:
LCD_8data(unsigned char rts)
{
// instructions //
}
now modified for 4 data
LCD_4data(unsigned char rt)
{
// Make BIT shift by 4 bit // /*here*/
// that DATA is to be shifted here //
}
// write a data byte to LCD
int lcdPutchar(int d)
{
// printf("%c", d);
LCDstatus.RS=1; // Take RS pin high for data
lcdNibble(d >>4); // Makeup Upper Nibble
lcdNibble(d); // Makeup Lower Nibble
return 1;
}
where LCDnibble Writes a nibble (4 bits) to the LCD