Embedded
programming for LCD display Interfacing
(Book:
The 8051 Microcontroller an Embedded Systems – using Assembly and C, Muhammad
Ali Mazidi, Janice Gillispie Mazidi, Rolin D. McKinlay)
LCD
Interfacing
Pin
|
Symbol
|
I/O
|
Description
|
1.
|
Vss
|
-
|
Ground
|
2.
|
Vcc
|
-
|
+5V
power supply
|
3.
|
VEE
|
-
|
Power
supply to control contrast
|
4.
|
RS
|
I
|
RS=0
– select command register
RS
=1 – select data register
|
5.
|
R/W
|
I
|
R/W=0
– Write
R/W=1
– Read
|
6.
|
E
|
I/O
|
Enable
|
7.
|
DB0-DB7
|
I/O
|
8-bit
data bus
|
LCD
Command Codes
Code
(Hex)
|
Command to LCD
instruction register
|
1
|
Clear
display screen
|
2
|
Return
home
|
4
|
Decrement
cursor (shift cursor to left)
|
6
|
Increment
cursor (shift cursor to right)
|
5
|
Shift
display 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 5×7 matrix
|
Example
Program:
To write/read on the LCD, first a set of commands
(from above table) should be sent to the LCD module to set mode and clear
display. Below is a set of functions in an order to make you understand easily.
(Don’t
consider the item displayed, instead “HELLO!” will be displayed)
No comments:
Post a Comment
Comment will be published after moderation only. Do not advertise here.