Many parallel character LCD displays use Hitachi HD44780 controller or chip with compatible interface. HD44780 is some kind of standard but I recommend to verify interface details in datasheet provided by vendor. There may be differences in commands and/or timing. Timing is important as Hitachi HD44780 needs time to process commands. If possible then check BUSY flag. If it is not possible then make sure your timing is correct.
This document is only my reference. You can find more details in Hitachi datasheet. Additionally you can find a lot of useful information on Dincer Aydin web page. There is section dedicated to LCD and web simulator: djlcdsim.
Internal RAM structure
Command Set
Clear Display
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
0 |
0 |
|
0 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
|
~ 1.52 ms
|
- Clear display data by writing 0x20 ("space") to whole DDRAM memory
- Set AC to DDRAM and 0x00
- Set entry mode to increment (I/D = 1)
Return Home
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
0 |
0 |
|
0 |
0 |
0 |
0 |
0 |
0 |
1 |
x |
|
~ 1.52 ms
|
- Set AC to DDRAM and 0x00
- Return cursor and display to home (original) postition
Entry Mode Set
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
0 |
0 |
|
0 |
0 |
0 |
0 |
0 |
1 |
I/D |
SH |
|
~ 38 us
|
- Set the moving diresction of cursor and display
- I/D = Increment / Decrement DDRAM address
- I/D = 1, cursor moves to right and DDRAM is increased by 1
- I/D = 0, cursor moves to left and DRAM is decreased by 1
- SH = Shift (scroll) of entire display
- SH = 1, after DDRAM write operation entire display is shifted (scrolled) according to I/D value
- SH = 0, no shifting (scrolling) is performed
Display ON / OFF Control
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
0 |
0 |
|
0 |
0 |
0 |
0 |
1 |
D |
C |
B |
|
~ 38 us
|
- D = Display On/Off
- D = 1, display is On
- D = 0, display is Off, content of DDRAM is preserved
- C = Cursor On/Off
- C = 1, cursor is enabled
- C = 0, cursor is disabled, but it's configuration is preserved (I/D, ...)
- B = Blink On/Off
- B = 1, blink is enabled, display will alternate between current data and 0xff character on cursor position
- B = 0, blink is disabled
Cursor or Display Shift
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
0 |
0 |
|
0 |
0 |
0 |
1 |
S/C |
R/L |
x |
x |
|
~ 38 us
|
Function set
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
0 |
0 |
|
0 |
0 |
1 |
DL |
N |
F |
x |
x |
|
~ 38 us
|
Set CGRAM Address
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
0 |
0 |
|
0 |
1 |
AC5 |
AC4 |
AC3 |
AC2 |
AC1 |
AC0 |
|
~ 38 us
|
Set DDRAM Address
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
0 |
0 |
|
1 |
AC6 |
AC5 |
AC4 |
AC3 |
AC2 |
AC1 |
AC0 |
|
~ 38 ms
|
Read Busy Flag and Address
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
0 |
1 |
|
BF |
AC6 |
AC5 |
AC4 |
AC3 |
AC2 |
AC1 |
AC0 |
|
~ 0 us
|
Write data to RAM
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
1 |
0 |
|
D7 |
D6 |
D5 |
D4 |
D3 |
D2 |
D1 |
D0 |
|
~ 38 us
|
Read data from RAM
RS |
R/W |
|
DB7 |
DB6 |
DB5 |
DB4 |
DB3 |
DB2 |
DB1 |
DB0 |
|
Execution Time
|
1 |
1 |
|
D7 |
D6 |
D5 |
D4 |
D3 |
D2 |
D1 |
D0 |
|
~ 38 us
|
Initialization of display
8-bit mode
4-bit mode