Page 1 of 1

LCD RS, E, RW and Data pins

Posted: Thu Sep 07, 2006 10:43 pm
by Hurdy
I need to program the LCD in C but the datasheet for the matrix multimedia board doesn't give me enough information.

Does anyone know what the RS, E, RW and Data pins are on PORTB?

And is it a 4bit or 8bit interface?

Posted: Fri Sep 08, 2006 10:30 am
by Steve
We connect to it using the 4bit interface. The LCD driver chip used is the KS0066U. Looking at its datasheet (do a web search) might give you some more clues, although I think we have replicated most of the important info inour own datasheets.

Here's the basic procedure to send info to the LCD:

Code: Select all

Put high nibble on B0-B3
Set or clear RS (B4) appropriately
Wait 100us
Set E high
Wait 100us
Set E low
Put low nibble on B0-B3
Set or clear RS (B4) appropriately
Wait 100us
Set E high
Wait 100us
Set E low
RS is set high to send characters to the display, or set low to send commands.

Assuming the above code has been created in a function called "LCD_RawSend", where the first parameter is the data and the second is the appropriate setting for RS, the following actions can be performed:

Init:

Code: Select all

LCD_RawSend(0x33, 0);  //set to 4-bit mode
LCD_RawSend(0x32, 0);  //set 4-bit mode (repeat)
LCD_RawSend(0x2c, 0);  //2-line, 5x11
LCD_RawSend(0x06, 0);  //move left, no display shift
LCD_RawSend(0x0c, 0);  //display on, cursor off
LCD_Clear();
Clear:

Code: Select all

LCD_RawSend(0x01, 0);  //clear display
delay_ms(1);
LCD_RawSend(0x02, 0);  //home
delay_ms(1);
Print Char:

Code: Select all

LCD_RawSend(Character, 0x10);
I hope this helps.