Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
16x2 LCD with 89C51 Microcontroller
1. 1
8051 Experiment
16x2 Line LCD with 89C51
Objective
To interface parallel 16 X 2 Characters LCD using 4 bit mode (6 I/O pins) with 89C2051 micro-
controller.
Liquid crystal displays commonly come in one, two, or four line versions. The length of line is typically
sixteen or twenty characters. Virtually all models are based on a common design with the same mi-
crocontroller driver. As a result, the pin-outs are identical. A few models simply renumber the pins
from the opposite direction.
The instruction set to all liquid crystal displays is common between manufacturers. The standard
character set is built into the onboard processor. Graphics can be created for the display, but these
typically require bit mapping.
Because of the control sequence, the LCD appears somewhat tedious. There are three groups of
routines.
LCD control lines. LCD commands: initialize, instruction, data, and busy. LCD communicate: display
message. The LCD has fourteen pins for connecting power, controls, and data. Connect contrast to
ground for maximum viewing intensity.
The liquid crystal display has three control lines -
Enable (pin 6)
Read/Write (pin5), and
Register select (pin 7).
It is wise to have the enable line asserted low before the other control lines are asserted. The regis-
ter select and the read/write are activated by software control. The commands are executed on the
low to high transition of the enable line. The high also allows data to be set-up. Data is transferred
with the enable line high.
Display of information requires initiating a control sequence. First the enable line is pulled low. Then
the control operation is implemented. Then the enable line is pulled high. Then the data is sent.
Then the enable line is pulled low. The timing diagram illustrates the relationship between the lines.