Page 295 - ARM Based Microcontroller Projects Using MBED
P. 295
CHAPTER
10
Using Liquid Crystal Displays (LCDs)
10.1 OVERVIEW
In this chapter we shall be developing projects using LCDs with the Nucleo-F411RE devel-
opment board. The highly popular HD44780 (or compatible)-type LCD is used in all the pro-
jects in this chapter.
Inmicrocontroller-basedsystems weusually wanttointeract withthe system,for example,to
enter a parameter, to change the value of a parameter, or to display the output of a measured
variable. Data is usually entered to a system using a switch, a small keypad, or a fully blown
keyboard. Data is usually displayed using an indicator such as one or more LEDs, 7-segment
displays, or LCD-type displays. The LCDs have the advantages that they can display alphanu-
mericaswellasgraphicaldata.SomeLCDshave40ormorecharacterlengthswiththecapability
todisplaydatainseverallines.SomeotherLCDscanbeusedtodisplaygraphicalimages(graph-
ical LCDs, or simply GLCDs), such as animation. Some displays are in single or in multicolor,
while some others incorporate back lighting so that they can be viewed in dimly lit conditions.
The LCDs can be connected to a microcontroller either in parallel form or in serial form.
Parallel LCDs (e.g., Hitachi HD44780) are connected using more than one data line and sev-
eral control lines and the data is transferred in parallel form. It is common to use either four or
eight data lines and two or more control lines. Using a four-wire connection saves I/O (input/
output) pins but it is slower since the data is transferred in two stages. Serial LCDs on the
other hand are connected to a microcontroller using only one data line. In these type of LCDs
data is usually sent to the LCD using the standard RS-232 asynchronous data communication
2
protocol or the I C bus protocol. Serial LCDs are in general much easier to use and require less
wiring, but they cost more than the parallel ones.
The programming of LCDs is a complex task and requires a good understanding of the
internal operations of the LCD controllers, including knowledge of their exact timing require-
ments. Fortunately, most high-level languages, including Mbed, provide special library func-
tions to control LCDs as well as GLCDs for displaying alphanumeric or graphical data. All the
user has to do is to connect the display to the microcontroller, define the connections between
the microcontroller and the display device in software, and then send commands to display
the required data on the LCD or the GLCD.
281
ARM-based Microcontroller Projects Using mbed # 2019 Elsevier Ltd. All rights reserved.
https://doi.org/10.1016/B978-0-08-102969-5.00010-0