Liquid Crystal Display
Liquid Crystal Display
LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing LEDs
(seven segment LEDs or other multi segment LEDs) because of the following reasons:
These components are “specialized” for being used with the microcontrollers, which
means that they cannot be activated by standard IC circuits. They are used for writing
A model described here is for its low price and great possibilities most frequently used in
practice. It is based on the HD44780 microcontroller (Hitachi) and can display messages in
two lines with 16 characters each . It displays all the alphabets, Greek letters, punctuation
marks, mathematical symbols etc. In addition, it is possible to display symbols that user
makes up on its own. Automatic shifting message on display (shift left and right), appearance
There are pins along one side of the small printed board used for connection to the
microcontroller. There are total of 14 pins marked with numbers (16 in case the background
Ground 1 Vss - 0V
8 D1 0/1 Bit 1
9 D2 0/1 Bit 2
10 D3 0/1 Bit 3
Data / commands
11 D4 0/1 Bit 4
12 D5 0/1 Bit 5
13 D6 0/1 Bit 6
LCD screen consists of two lines with 16 characters each. Each character consists of
5x7 dot matrix. Contrast on display depends on the power supply voltage and whether
messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is applied
on pin marked as Vee. Trimmer potentiometer is usually used for that purpose. Some
versions of displays have built in backlight (blue or green diodes). When used during
operating, a resistor for current limitation should be used (like with any LE diode).
LCD BASIC COMMANDS
All data transferred to LCD through outputs D0-D7 will be interpreted as commands
or as data, which depends on logic state on pin RS:
LCD CONNECTION
Depending on how many lines are used for connection to the microcontroller, there
are 8-bit and 4-bit LCD modes. The appropriate mode is determined at the beginning of the
process in a phase called “initialization”. In the first case, the data are transferred through
outputs D0-D7 as it has been already explained. In case of 4-bit LED mode, for the sake of
saving valuable I/O pins of the microcontroller, there are only 4 higher bits (D4-D7) used for
Consequently, each data is sent to LCD in two steps: four higher bits are sent first
(that normally would be sent through lines D4-D7), four lower bits are sent afterwards. With
the help of initialization, LCD will correctly connect and interpret each data received.
Besides, with regards to the fact that data are rarely read from LCD (data mainly are
transferred from microcontroller to LCD) one more I/O pin may be saved by simple
connecting R/W pin to the Ground. Such saving has its price. Even though message
displaying will be normally performed, it will not be possible to read from busy flag since it
LCD INITIALIZATION
Once the power supply is turned on, LCD is automatically cleared. This process lasts
for approximately 15mS. After that, display is ready to operate. The mode of operating is set
1. Display is cleared
2. Mode
3. Display/Cursor on/off
D = 0 Display off
U = 0 Cursor off
4. Character entry
ID = 1 Addresses on display are automatically incremented by 1
Automatic reset is mainly performed without any problems. Mainly but not always! If
for any reason power supply voltage does not reach full value in the course of 10mS, display
will start perform completely unpredictably. If voltage supply unit can not meet this condition
connection to the microcontroller is through 4- or 8-bit interface. All left over to be done after
CONTRAST CONTROL:
To have a clear view of the characters on the LCD, contrast should be adjusted. To
adjust the contrast, the voltage should be varied. For this, a preset is used which can behave
like a variable voltage device. As the voltage of this preset is varied, the contrast of the LCD
can be adjusted.
Fig: Variable resistor
Potentiometer
This arrangement is normally used to vary voltage, for example to set the switching point of a circuit
with a sensor, or control the volume (loudness) in an amplifier circuit. If the terminals at the ends of
the track are connected across the power supply, then the wiper terminal will provide a voltage
which can be varied from zero up to the maximum of the supply.
Potentiometer Symbol
Presets
These are miniature versions of the standard variable resistor. They are designed to be
mounted directly onto the circuit board and adjusted only when the circuit is built. For example to
set the frequency of an alarm tone or the sensitivity of a light-sensitive circuit. A small screwdriver or
similar tool is required to adjust presets.
Presets are much cheaper than standard variable resistors so they are sometimes used in projects
where a standard variable resistor would normally be used.
Multiturn presets are used where very precise adjustments must be made. The screw must
be turned many times (10+) to move the slider from one end of the track to the other, giving
very fine control.
Preset Symbol
Vcc
P2.0 4 (RS) 1
Gnd
P2.1 5 (R/W) 2
P2.2 6(EN) 3
PRESET
(CONTRAST
CONTROL)
LCD
89C51 P1.0 D0
P1.1 D1
P1.2 D2
P1.3 D3
P1.4 D4
P1.5 D5 15
P1.6 D6 16
P1.7 D7