Christoph's - LCD

The Philips LTN211R-10 (HD 44780 compatible) LCD Panel

Front of LCD

Input pins:

Initializing 4bit mode

The LCD can be interfaced using all 8 data pins, or alternatively using just pins 4,5,6,7. I chose to use 4-bit-mode, because this way I had to use less output pins of my microcontroller.
I used the following sequence:
Rise E (as LCD will read on falling edge)
Lower R/W (Write mode)
Lower RS (instruction mode)

Transmit high nibble of "8bit mode" three times
 Set output pins to "0011" (pins 4-7 on LCD!)
 Lower E
 Rise E
 Wait some ms

Transmit high nibble of "4bit mode" once
 Set output pins to "0010" (pins 4-7 on LCD!)
 Lower E
 Rise E
 Wait some ms
This sequence will switch back to 8bit mode (if the LCD has already been initialized) and then enter 4bit mode.

Transmitting data

To transmit 8bit data in 4bit mode we will transmit the upper 4 bits first, then the lower 4 bits.
I used the following sequence:
Save old status of RS

Transmit high nibble of data to be sent
Lower E
Rise E

Transmit low nibble of data to be sent
Lower E
Rise E

Rise R/W (we read...)
Lower RS (...in instruction mode)

(E is still high, so the LCD will immediately transmit the status of the busy flag)

Wait while LCD is busy (bit 7 of status data is high)
 Receive high nibble of status data 
 Lower E
 Rise E 
 Receive low nibble of status data 
 Lower E
 Rise E 
 Wait some ms

Restore old status of RS

Lower R/W (back to write mode)

Initializing the display

To initialize the display I sent the following data:
"0010 1000" - Multi-line-mode
"0000 1100" - Display on
"0000 0001" - Clear display
"0000 0110" - LTR output

Source

Links

Navigation