6.3 LCD and Keypad
6.3 LCD and Keypad
LCD DISPLAY
This component is specifically manufactured to be used with
microcontrollers, which means that it cannot be activated by
standard IC circuits.
It is used for displaying different messages on a miniature
liquid crystal display.
The model described here is for its low price and great
capabilities 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 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 CONNECTING
Depending on how many lines are used for connecting an LCD to the
microcontroller, there are 8bit and 4bit LCD modes.
The appropriate mode is selected at the beginning of the operation
in the process called 'initialization'.
The 8bit LCD mode uses outputs D0 D7 to transfer data as
explained on the previous page.
The main purpose of the 4bit LCD mode is to save valuable I/O pins
of the microcontroller.
Only 4 higher bits (D4D7) 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 D4D7), then four lower
bits.
Initialization enables the LCD to link and interpret received bits
correctly.
Data is rarely read from the LCD (it is mainly transferred from
the microcontroller to the LCD) so it is often possible to save
an extra I/O pin by simple connecting the R/W pin to the
Ground.
Such a saving has its price. Messages will be normally
displayed, but it will not be possible to read the busy flag
since it is not possible to read the display either.
Fortunately, there is a simple solution. After sending a
character or a command it is important to give the LCD
enough time to do its job.
Owing to the fact that the execution of a command may last
for approximately 1.64mS, it will be sufficient to wait about
2mS for the LCD.
LCD OPERATION
In recent years, the LCD has been finding widespread use
replacing LEDs (sevensegment LEDs or other multisegment
LEDs. This is due to the following reasons:
1. The declining prices of LCDs.
2. The ability to display numbers, characters, and graphics,
this is contrast to LEDs, which are limited to numbers
and a few characters.
3. Incorporation of a 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 character and graphics.
Symbol
I/O Description
VSS
Ground
VCC
+5 V Power Supply
VEE
RS
R/W
DB0
DB1
DB2
10
DB3
11
DB4
12
DB5
13
DB6
14
DB7
I/O Enable
Return home
Decrement cursor
(shift cursor to left)
Code
(Hex)
Increment cursor
(shift cursor to right)
10
14
18
1C
80
C0
38
KEYBOARD INTERFACING
In this sections, we will discuss keyboard fundamental,
along with key press detection and key identification
mechanisms. Then we show how a keyboard is interfaced
to a PIC 18.
REVIEW QUESTIONS :
Jun 2012
1. Describe the function of pins R/W and E in the LCD.
(4 marks)
Jun 2013
1. Explain the command RS=0, RS=1, R/W=0 and R/W=1 for LCD
operation.
(4 marks)