Most projects you create with the 8051 CPU require some form of  display.  The most common way to accomplish this is with the LCD  (Liquid Crystal Display).  LCDs have become a cheap and easy way to get text display for an embedded system Common displays are set up as 16 to 20 characters by 1 to 4 lines. We will here discuss about the LCD 16×2.


• 8 data pins D7:D0

Bi-directional data/command pins.
Alphanumeric characters are sent in ASCII format.

• RS:  Register Select

RS = 0 -> Command Register is selected
RS = 1 -> Data Register is selected

• R/W: Read or Write

0 -> Write,  1 -> Read

• E: Enable (Latch data)

Used to latch the data present on the data pins.
A high-to-low edge is needed to latch the data.

• VEE : contrast control

NOTE: When writing to the display, data is transferred only on the high to low transition of this signal. However, when reading from the display, data will become available shortly after the low to high transition and remain available until the signal falls low again.

Display Data RAM (DDRAM)

Display data RAM (DDRAM) is where you send the characters (ASCII code) you want to see on the LCD screen. It stores display data represented in 8-bit character codes. Its capacity is 80 characters (bytes).  Below you see DD RAM address layout of a 2*16 LCD.

In the above memory map, the area shaded in black is the visible display (For 16x2 display) .For first line addresses for first 15 characters is from 00h to 0Fh. But for second line address of first character is 40h and so on up to 4Fh for the 16th character.So if you want to display the text at specific positions of LCD , we require to manipulate address and then to set cursor position accordingly .

Character Generator RAM (CGRAM)-User defined character RAM

In the character generator RAM, we can define our  own character patterns by program. CG RAM is 64 bytes ,allowing for eight 5*8 pixel, character patterns to be defined. However how to define this and use it  is out of scope of this tutorial. So I will not talk any more about CGRAM


The HD44780 has two 8-bit registers, an instruction register (IR) and a data register (DR). The IR stores instruction codes. The DR temporarily stores data to be written into DDRAM or CGRAM and temporarily stores data to be read from DDRAM or CGRAM. Data written into the DR is automatically written into DDRAM or CGRAM by an internal operation. These two registers can be selected by the register selector (RS) signal. See the table below.

Busy Flag (BF)

When the busy flag is 1, the LCD  is in the internal operation mode, and the next instruction will not be accepted. When RS = 0 and R/W = 1 (see the table above), the busy flag is output to DB7 (MSB of LCD data bus). The next instruction must be written after ensuring that the busy flag is 0.

LCD Commands

The LCD’s internal controller accept several commands and modify the display accordingly. These commands would be things like:
– Clear screen
– Return home
– Shift display right/left





Who's new

  • ravirajpatil871...
  • shubhambajoria
  • yassir
  • demiholyman890954
  • scottgillum51169040

Get Notified



We are Social


Subscribe to Syndicate