Scrolling text on LCD using PIC16F877A and MikroC
In this tutorial I will show you how to scrolling text in LM16x2 LCD using PIC microcontroller.
You can watch the video and read the written tutorial below.
In this tutorial I am use PIC16F877A microcontroller & LM16X2 LCD display. PIC16F877A microcontroller 8KB flash program memory & 256 Byte EEPROM memory.
LM 16X2 LCD Display
LCD means Liquid Crystal Display. In this project I am use LM 16X2 LCD Display. 16X2 means 16 column & 2 row in this display. There are 16*2 = 32 segment in this display. Each segment hold 8x2 dot patterns.
Circuit Diagram
In this tutorial I am use Mikro C Pro For PIC compiler for coding. Mikro C Pro For Pic provide a comfortable LCD library for LCD interfacing.
MikroC code
// Lcd module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
//end LCD module connection
char txt1[]= "WELCOME TO" ;
char txt2[] = "MINA TECHNOLOGY" ;
char i ; // loop variable
void main() {
Lcd_Init(); //initialize lcd module;
Lcd_Cmd(_LCD_CLEAR); //clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // cursor off
Lcd_Out(1,3,txt1); //write text 1st row
Lcd_Out(2,1,txt2); //write text 2nd row
delay_ms(2000);
// Moving text
for(i=0;i<4;i++){
Lcd_Cmd(_LCD_SHIFT_RIGHT); // text shift right
Delay_ms(500); // 500ms delay
}
while(1){
for(i=0;i<8;i++){
Lcd_Cmd(_LCD_SHIFT_LEFT); // text shift left
Delay_ms(500);
}
for(i=0;i<8;i++){
Lcd_Cmd(_LCD_SHIFT_RIGHT); //text shift right
Delay_ms(500);
}
}
}
Download free source code
Post Comments