moving message display on LCD using 8051 microcontroller.

moving message on lcd

LCD use in many device to display message, like in printer, coffee machine, remote etc.There are a lot of type  LCD present in market, these are may be alphanumeric, graphical or any other type. Here I will discuss about the alphanumeric LCD.

Alphanumeric LCD comes in different size 8*1, 8*2, 16*1, 16*2 or 20*4 etc. These LCD only able to display characters, who have the ASCII value. Some alphanumeric LCD provide the facility to generate own custom characters.

In this article I will describe the steps to display moving message on 16*2 alphanumeric LCD, but before it I want to discuss about its pin configuration and connection.

Pin configuration of 16*2 alphanumeric LCD

lcd pins

Pin Description of Pin
1.VSS (Ground Pin).
2.VCC (+3.3 to +5V).
3.VEE (Use to adjust the contrast).
4.RS (Resistor select pin).

RS = 0; select command resistor.

RS = 1; select data resistor.

5.R/W (Read and Write Pin)

R/W = 0; write operation.

R/W = 1; Read operation.

6.E (clock enable pin).
7.D0  (I/O)
8.D1  (I/O)
9.D2  (I/O)
10.D3  (I/O)
11.D4  (I/O)
12.D5  (I/O)
13.D6  (I/O)
14.D7  (I/O)
15.Led  (+ve).
16.Led  (-ve).

Note: Interface of HD44780 supports two modes operation, 8 bit mode and 4 bit mode.In this article I will only discuss about the 8 bit mode.

Some useful commands for LCD

Command Description
0x01To clear LCD.
0x0eDisplay on and cursor blink.
0x0cDisplay on and cursor off.
0x388 bit mode and 2 line 5*8 matrix.
0x06Increment cursor (shift toward right)
0x04Decrement cursor (shift toward left)
0x80Cursor in beginning of first line.
0xc0Cursor in beginning of second line.

Steps to write display message on LCD

  • Initialize the LCD using the LCD initialization commands.
  • Set the address of DDRAM ,where you want to display the character.
  • Write the character on the data bus of LCD.
When we pass command or data on LCD then follow following steps.
  • If passing the command then make RS pin low (RS = 0) either for data make RS pin high (RS = 1).
  • Set Enable pin high (EN = 1).
  • Write the command or data on the data bus.
  • Set Enable pin low (EN = 0).

If you want to learn more about the c language, here 10 Free days (up to 200 minutes) C video course for you.

Your free trial is waiting

Source code to display moving message on 16×2 alphanumeric LCD.

moving message on lcd



  1. Please can this code scroll more than 80 characters, up to 150 characters on the LCD, thanks in anticipation for a quick response

Leave a Reply