ES Slids Lec14N
ES Slids Lec14N
ES Slids Lec14N
(630470)
Lecture 14
LCD Interfacing
Prof. Kasim M. Al-Aubidy
Philadelphia University
LCD DISPLAY:
• This component is specifically manufactured to be used with
microcontrollers. It is used for displaying different messages on a small
liquid crystal display.
LCD DISPLAY: Simple Model.
• The model described here is for its low price and great
capabilities most frequently used in practice:
– It can display messages in two lines with 16 characters
each.
– It can display all the letters of alphabet, Greek letters,
punctuation marks, mathematical symbols etc.
– It is also possible to display symbols made up by the user.
– Other useful features include automatic message shift
(left and right), cursor appearance, LED backlight etc.
LCD Display Pins:
Function Pin Name Logic State Description
No.
Ground 1 Vss - 0V
Power supply 2 Vdd - +5V
Contrast 3 Vee - 0-Vdd
1. DDRAM Memory:
• DDRAM memory is used for storing characters to be
displayed. The size of this memory is capable of storing 80
characters. Some memory locations are directly connected
to the characters on display.
• Everything works quite simply: it is enough to configure the
display to increment addresses automatically (shift right)
and set the starting address for the message to be
displayed (for example 00 hex).
• Afterwards, all characters sent through lines D0-D7 will be
displayed in the message format.
• In this case, displaying starts from the first field of the first line
because the initial address is 00 hex.
• If more than 16 characters are sent, then all of them will be
memorized, but only the first sixteen characters will be visible.
In order to display the rest of them, the shift command should
be used.
2. CGROM Memory:
• CGROM memory
contains a standard
character map with all
characters that can be
displayed on the
screen. Each character
is assigned to one
memory location:
LCD Basic Commands:
• All data transferred to an LCD through the outputs D0-D7 will be
interpreted as a command or a data, which depends on the RS pin logic
state:
• RS = 1 - Bits D0 - D7 are addresses of the characters to be displayed.
LCD processor addresses one character from the character map and
displays it. The DDRAM address specifies location on which the
character is to be displayed. This address is defined prior to transferring
character or the address of the previously transferred character is
automatically incremented.
• RS = 0 - Bits D0 - D7 are commands for setting the display mode.
• Here is a list of commands recognized by the LCD:
LCD Connecting
• Depending on how many lines are used for connecting an LCD to the
microcontroller, there are 8-bit and 4-bit LCD modes. The appropriate
mode is selected at the beginning of the operation in the process called
'initialization'. The 8-bit LCD mode uses outputs D0- D7 to transfer data
as explained on the previous page.
• The main purpose of the 4-bit LCD mode is to save valuable I/O pins of
the microcontroller. Only 4 higher bits (D4-D7) are used for
communication, while others may be left unconnected. Each piece of
data is sent to the LCD in two steps- four higher bits are sent first
(normally through the lines D4-D7), then four lower bits. Initialization
enables the LCD to link and interpret received bits correctly.
LCD Initialization:
• The LCD is automatically cleared when powered up. It lasts for
approximately 15mS. After this, it is ready for operation. The mode of
operation is set by default, which means that:
• Display is cleared.
• Mode
DL = 1 - Communication through 8-bit interface
N = 0 - Messages are displayed in one line
F = 0 - Character font 5 x 8 dots
• Display/Cursor on/off
D = 0 - Display off
U = 0 - Cursor off
B = 0 - Cursor blink off
• Character entry
ID = 1 Displayed addresses are automatically incremented by 1
S = 0 Display shift off