|
R/W
- read/write:
R/W
input allows the user to write information to the LCD or read
information from it. R/W = 1 when reading; R/W =0 when
writing.
E -
enable:
The
enable pin is used by the LCD to latch information presented
to its data pins. When data is supplied to data pins, a high
to low pulse must be applied to this pin in order for the LCD
to latch in the data present at the data pins. This pulse must
be a minimum of 450 ns wide.
D0 –
D7:
The 8
bit data pins, D0 – D7, are used to send information to the
LCD or read the contents of the LCD’s internal registers.
To
display letters and numbers, we send ASCII codes for the
letters A – Z, a – z, and numbers 0 – 9 to these pins while
making RS = 1.
There
are also instructions command codes that can be sent to the
LCD to clear the display or force the cursor to the home
position or blink the cursor. Table below lists the instruction
command codes.
|
Code (hex) |
Command to LCD
Instruction Register |
|
1 |
Clear
display screen |
|
2 |
Return
home |
|
4 |
Shift
cursor to left |
|
5 |
Shift
display right |
|
6 |
Shift
cursor to right |
|
7 |
Shift
display left |
|
8 |
Display
off, Cursor off |
|
A |
Display
off, Cursor on |
|
C |
Display
on, cursor off |
|
E |
Display
on, cursor blinking |
|
F |
Display
on, cursor blinking |
|
10 |
Shift
cursor position to left |
|
14 |
Shift
cursor position to right |
|
18 |
Shift the
entire display to the left |
|
1C |
Shift the
entire display to the right |
|
80 |
Force
cursor to beginning of 1st line |
|
C0 |
Force
cursor to beginning of 2nd line |
|
38 |
2 lines
and 5x7 matrix |
We
also use RS = 0 to check the busy flag bit to see if the LCD
is ready to receive information. The busy flag is D7 and can
be read when R/W =1 and RS = 0, as follows: if R/W =1, RS =0.
When D7 = 1(busy flag = 1), the LCD busy taking care of
internal operations and will not accept any new information.
When D7 = 0, the LCD is ready to receive new information.
Note: It is recommended to check the busy flag before writing
any data to the LCD.
Example programs are given in the next page.
|
Next page |
Other Microcontroller projects
and articles
Digital
IC Tester using 8951 Microcontroller
Automatic
Railway Gate Control
Car
parking system using 8051 Microcontroller
8051
microcontroller Instruction Set
8051
Microcontroller port programming
Programmable
number lock system
Water
level indicator cum controller
Robotic
car
Intelligent Train Engines
DC
Motor Controlling System using PIC
For more projects
click here
|