The commands for
HD44780 chip are shown in the table below. Scroll down to see
the commands in binary, and more info on the entry mode set command.
INSTRUCTION
|
Decimal
|
Hexadecimal
|
Function
set (8-bit interface, 2 lines, 5*7 Pixels) |
56
|
38
|
Function
set (8-bit interface, 1 line, 5*7 Pixels) |
48
|
30
|
Function
set (4-bit interface, 2 lines, 5*7 Pixels) |
40
|
28
|
Function
set (4-bit interface, 1 line, 5*7 Pixels) |
32
|
20
|
Entry
mode set |
|
|
Scroll
display one character right (all lines) |
28
|
1E
|
Scroll
display one character left (all lines) |
24
|
18
|
Home
(move cursor to top/left character position) |
2
|
2
|
Move
cursor one character left |
16
|
10
|
Move
cursor one character right |
20
|
14
|
Turn
on visible underline cursor |
14
|
0E
|
Turn
on visible blinking-block cursor |
15
|
0F
|
Make
cursor invisible |
12
|
0C
|
Blank
the display (without clearing) |
8
|
08
|
Restore
the display (with cursor hidden) |
12
|
0C
|
Clear
Screen |
1
|
01
|
Set
cursor position (DDRAM address) |
128 + addr
|
80+ addr
|
Set
pointer in character-generator RAM (CG RAM address) |
64 + addr
|
40+ addr
|
Read
DDRAM/CGRAM & Check Busy Flag |
|
|
Entry
mode set command
This command sets
cursor move direction and display shift ON/OFF. There are 4 possible
function set commands;04, 05, 06, and 07. This command changes
the direction the cursor moves by setting the address counter
to increment or decrement. This command is very important. If
you do not understand it you may not see anything or what you
actually wanted to see on LCD screen. I have created 4 animated
gifs to demonstrate what the function set command is all about.
When my friend
Hakan Dereli wanted to learn about LC displays I gave him an LC
display and the 4*4 keyboard that I used with my Z80 system.The
keyboard is based on a 74C922 chip and my circuit to convert the
4 bit data output of the 74C922 to 8 bit data.It also has 3 other
buttons on it.This makes it great to experiment with LCDs by entering
commands/data manually. Hakan tested all possible commands by
sending all the numbers between 00h and FFh to the LCD to see
if there is an undocumented feature and see how all commands work.
He did not find anything undocumented, but he noted how LCD behaves
after each function set command.
Below are the gifs
to demonstrate those commands. To demonstrate the effect of each
function set command it is assumed that the LCDs below are 2*16
LC Displays with DD RAM address set to 8 and underline cursor
ON. Note that when the address counter is set to DECREMENT, strings
sent to the LCD will be printed in reverse order. The same thing
applies to the CG RAM, as well.
Entry
mode set command 04h
 |
Decrement Address
Counter
Display Shift
:OFF
String:Dereli
|
Entry
mode set command 05h
 |
Display Shift
:ON
Decrement Address
Counter
String :Hakan
|
Entry
mode set command 06h
 |
Display Shift :OFF
Increment Address Counter
String:Dereli
|
Entry
mode set command 07h
 |
Display Shift :ON
Increment Address Counter
String:Hakan
|
Checking
the Busy Flag
To check the state
of the busy flag and read the address counter