Scrolling Text on LCD by PIC microcontroller is very simple but very important one. For moving forward we need
Now to start with Scrolling text on LCD by PIC microcontroller in 4 bit mode, we need support of
- 1 Proteus 7 Professional (where we Make your hardware arrangement our project and simulate it to see the result)
- 2 Mikcro C. (here we write the Embedded C Program and build the hex file of that)
So we start with Proteus 7 Professional
To build Scrolling text on LCD by PIC microcontroller in 4 bit mode, we need to add some device in proteus as like in other project we did. Those are
- 1) Crystal
- 2) Pic16f877
- 3) LM016L ( LCD display)
Now how to add, make the interfacing and to see the result of our project how it simulates? See my video in below where I show you step by step.
In Makcro C
See in Makcro C how to display text in LCD I already discus in my previous post at Displaying text on LCD by interfaced with PIC16F877 microcontroller in 4 bit mode . so in this post I not discussing tish portion I only discuss how to scrolling the text. For scrolling the text we have to know some other command those are
LCD_SHIFT_RIGHT (By this command text on LCD shift one bit position in Right)
LCD_SHIFT_LEFT (By this command text on LCD shift one bit position in left)
Now how many time or how many bit position we have to shift in right or left that have to count according to our word which we want to display. Let suppose we want to display word WWW.NBCAFE.IN It has 13 alphabet show to complete shift this word on right side we have to execute 13 time LCD_SHIFT_RIGHT command. For execute 13 time the command we should use loop to make it simple. Here we use for loop for executing LCD_SHIFT_RIGHT command 13 times. And syntax of for loop same as simple c programming like that “for(i=0;i<=13;i++)”.
Now another thing I should mansion that in LM016L LCD display it has two row and 16 column. So we can display easily two line of text for that just we have to send two times like that
LCD_out(1,1,”www.nbcafe.in”);
LCD_out(2,1,”The platform of Engineers”);
Now see the complete code of our simple project Scrolling Text on LCD by PIC microcontroller
// Author : Subham Dutta
// Date : 09-09-13
// Website : www.nbcafe.in
int i,j;
void main() {
TRISD=0;
LCD_init(&portd);
LCD_cmd(LCD_CLEAR);
LCD_cmd(LCD_CURSOR_OFF);
while(1){
LCD_out(1,1,”www.nbcafe.in”);
delay_ms(100);
LCD_out(2,1,”The platform of Engineers”);
delay_ms(100);
for(i=0;i<=15;i++)
{
LCD_cmd(LCD_SHIFT_RIGHT);
delay_ms(100);
}
for(j=0;j<=15;j++)
{
LCD_cmd(LCD_SHIFT_LEFT);
}
}
}