LCD interfacing theory
In this
tutorial I will show you the operation modes of LCD then describe how to
program and interface an LCD with 8051 using C language.
Operation of LCD
Now a day’s
LCD is finding widespread use replacing LEDs (7 segment LEDs or other multi 7
segment LEDs). For the following reasons………
1.
The
declining or lower price of LCDs.
2.
Wide
range of use (ability to display numbers, characters, and graphics). This is in
contrast to LEDs, which are limited to numbers and a few characters.
3.
Incorporation
of refreshing controller into the LCD, thereby relieving the CPU of the task of
refreshing the LCD. In contrast, the LED must be refreshed by the CPU (or in
some other way) to keep displaying the data.
4.
Ease
of programming for characters and graphics.
LCD pin description
Pin
|
Symbol
|
I/O
|
Description
|
1
|
Vss
|
-
|
GND
|
2
|
Vcc
|
-
|
+5V power supply
|
3
|
Vee
|
-
|
Power supply to control contrast
|
4
|
RS
|
I
|
RS=0 to select command register
RS=1 to select data register
|
5
|
R/W
|
I
|
R/W=0 for write, R/W=1 for read
|
6
|
E
|
I/O
|
Enable
|
7
|
DB0
|
I/O
|
The 8-bit data bus
|
8
|
DB1
|
I/O
|
The 8-bit data bus
|
9
|
DB2
|
I/O
|
The 8-bit data bus
|
10
|
DB3
|
I/O
|
The 8-bit data bus
|
11
|
DB4
|
I/O
|
The 8-bit data bus
|
12
|
DB5
|
I/O
|
The 8-bit data bus
|
13
|
DB6
|
I/O
|
The 8-bit data bus
|
14
|
DB7
|
I/O
|
The 8-bit data bus
|
RS register select
There are two important registers inside the LCD. The RS pin
is used for their selection as follows. If RS=0, the instruction command code
register is selected, allowing the user to send a command such as clear
display, cursor at home, etc. If RS=1 the data register is selected, allowing
the user to send data to be displayed on the LCD.
RW, 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 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.
LCD Command Codes
HEX Code
|
|
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 off, cursor off
|
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
|
Cursor to beginning of 1st
line
|
C0
|
Cursor to beginning of 2nd
line
|
38
|
2 lines and 5x7 matrix
|
|
|
No comments:
Post a Comment