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();
}
}
Share on FacebookShare on Google+Tweet about this on TwitterShare on RedditShare on StumbleUponPin on Pinterest

Related Designs and Schematics

The following two tabs change content below.

Frank Donald

Junior Network Engineer at Tata Communications
Frank Donald is an Electronics and Communication Engineer who is very passionate about his subject. Reading, Surfing and Blogging are the things he loves.

Ask your query

Be the First to Comment!

Notify of
avatar
wpDiscuz