LCD
Introduction
The most commonly used Character based LCDs are based on Hitachi's HD44780 controller.
Pin Description
The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have
only 1 controller and support at most of 80 characters, whereas LCDs supporting more than 80
characters make use of 2 HD44780 controllers.
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins are extra in
both for back-light LED connections). Pin description is shown in the table below.
Character LCD type HD44780 Pin diagram
Pin No. Name Description
Pin no. 1 VSS Power supply (GND)
Pin no. 2 VCC Power supply (+5V)
Pin no. 3 VEE Contrast adjust
0 = Instruction input
Pin no. 4 RS
1 = Data input
0 = Write to LCD module
Pin no. 5 R/W
1 = Read from LCD module
Pin no. 6 EN Enable signal
Pin no. 7 D0 Data bus line 0 (LSB)
Pin no. 8 D1 Data bus line 1
Pin no. 9 D2 Data bus line 2
Pin no. 10 D3 Data bus line 3
Pin no. 11 D4 Data bus line 4
Pin no. 12 D5 Data bus line 5
Pin no. 13 D6 Data bus line 6
Pin no. 14 D7 Data bus line 7 (MSB)
DDRAM - Display Data RAM
Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its extended
capacity is 80 X 8 bits, or 80 characters. The area in display data RAM (DDRAM) that is not used for
display can be used as general data RAM. So whatever you send on the DDRAM is actually displayed on
the LCD. For LCDs like 1x16, only 16 characters are visible, so whatever you write after 16 chars is
written in DDRAM but is not visible to the user.
DDRAM Address for 1 Line LCD
DDRAM Address for 2 Line LCD
CGROM - Character Generator ROM
The character generator ROM generates 5 x 8 dot or 5 x 10 dot character patterns from 8-bit character
codes (see Figure 5 and Figure 6 for more details). It can generate 208 5 x 8 dot character patterns and
32 5 x 10 dot character patterns. User defined character patterns are also available by mask-
programmed ROM.
LCD characters code map for 5x8 dots
CGRAM - Character Generator RAM
As clear from the name, CGRAM area is used to create custom characters in LCD. In the character
generator RAM, the user can rewrite character patterns by program. For 5 x 8 dots, eight character
patterns can be written.
BF - Busy Flag
Busy Flag is an status indicator flag for LCD. When we send a command or data to the LCD for
processing, this flag is set (i.e BF =1) and as soon as the instruction is executed successfully this flag is
cleared (BF = 0). This is helpful in producing and exact amount of delay for the LCD processing.
To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The MSB of the LCD data bus (D7)
act as busy flag. When BF = 1 means LCD is busy and will not accept next command or data and BF = 0
means LCD is ready for the next command or data to process.
Instruction Register (IR) and Data Register (DR)
There are two 8-bit registers in HD44780 controller Instruction and Data register. Instruction register
corresponds to the register where you send commands to LCD e.g LCD shift command, LCD clear, LCD
address etc. and Data register is used for storing data which is to be displayed on LCD. When send the
enable signal of the LCD is asserted, the data on the pins is latched in to the data register and data is
then moved automatically to the DDRAM and hence is displayed on the LCD.
Data Register is not only used for sending data to DDRAM but also for CGRAM, the address where you
want to send the data, is decided by the instruction you send to LCD.