Animated Scrolling Text in 16×2 LCD using 8051 Microcontroller

Share on FacebookShare on Google+Tweet about this on TwitterShare on RedditShare on StumbleUponPin on Pinterest
animation-scrolling-text-lcd-16x2-8051-microcontroller
Scrolling text animation in 16×2 LCD

LCD’s are widely used where user interaction with the system is necessary and you might have come across static message display using LCD. The message displayed on the LCD can also be animated like blinking, scrolling etc. This article explains how to display a running or animated scrolling text in a 16 x 2 LCD display with a 8051 Microcontroller. 

16 x 2 LCD:

pin-diagram-configuration-16x2-lcd-display
16×2 LCD Display

In a 16 x 2 LCD a message is displayed by means of configuring it through commands initially and then send the data to be displayed on it. A two registers namely Command and Data register are used to serve this purpose in a LCD. Read more about Displaying static message in a LCD screen to acquire full knowledge about it. 

It only take few extra steps to make text scrolling in a LCD screen. There are two specific commands which we use for the purpose of text scrolling. They are

0x18 – Shift Entire Display Left

0x1C- Shift Entire Display Right

Using these commands we have to shift our message either left or right continuously by means of placing it in an infinite loop. Doing this we can achieve the scrolling effect of Message in LCD from right to left or vice versa.

CODE:

#include<reg51.h>
#include<string.h>
void delay(void);
sbit rs=P3^0;
sbit rw=P3^1;
sbit en=P3^2;
code unsigned char a[3]={0x38,0x0f,0x06};
code unsigned char b[12]="GADGETRONICX";
unsigned int i,j,k,l;
void cmdwrite()
  {
    rs=0;
    rw=0;
    en=1;
    delay();
    en=0;
  }
void datawrite()
  {
   rs=1;
   rw=0; 
   en=1;
  delay();
  en=0;
  }
void delay()
  {
   for(k=1;k<4000;k++);
    {
      for(l=1;l<=5000;l++);
    }
  }
void main()
{
for(i=0;i<=2;i++)
{
P1=a[i];
cmdwrite();
delay();
}
P1=0x80;
cmdwrite();
delay();
for(j=0;j<=11;j++)
{
P1=b[j];
datawrite();
}
while(1)
{
P1=0x18;
cmdwrite();
delay();
}
}

Related Designs and Schematics

Share on FacebookShare on Google+Tweet about this on TwitterShare on RedditShare on StumbleUponPin on Pinterest
The following two tabs change content below.
Frank Donald

Frank Donald

Junior Network Engineer at Tata Communications
Frank Donald is an Electronics and Communication Engineer who loves building stuff in his free time. Video games, blogging and programming are the things he loves most

Ask your query

5 Comments on "Animated Scrolling Text in 16×2 LCD using 8051 Microcontroller"

Notify of
avatar
Sort by:   newest | oldest | most voted
Praisy Samuel
Guest

I would like to attach a file on Keil C code.
How can I attach a file to the code.. What are the modifications that I should make in the code.
Please let me know the exact code that includes this attaching
The file that I would like to attach should contain the texts that I want to display on 16×2 LCD display

Kalyani
Guest

Plz tell in place of sentence how we can access a .txt file

kalyani
Guest

in place of sentance how we a .txt file

wpDiscuz