0% found this document useful (0 votes)
46 views

Code 5: Interfacing LCD and All Commands

This document contains code to interface an LCD display in 4-bit mode using port 2 of a microcontroller. It initializes the LCD, displays various text strings on different rows, and then continuously shifts the text left and right using LCD commands for scrolling. The code was written by Aman Jain and Shreyashi to display and scroll text on an LCD.

Uploaded by

Deeksha Saxena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Code 5: Interfacing LCD and All Commands

This document contains code to interface an LCD display in 4-bit mode using port 2 of a microcontroller. It initializes the LCD, displays various text strings on different rows, and then continuously shifts the text left and right using LCD commands for scrolling. The code was written by Aman Jain and Shreyashi to display and scroll text on an LCD.

Uploaded by

Deeksha Saxena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Code 5: Interfacing LCD and all commands

/* Details: - LCD interfacing


- LCD is connected to port 2 and working as 4 bit
Author: Aman Jain,Shreyashi
*/
// LCD module connections
sbit LCD_RS at P2_0_bit;
sbit LCD_EN at P2_1_bit;
sbit
sbit
sbit
sbit

LCD_D4
LCD_D5
LCD_D6
LCD_D7

at P2_2_bit;
at P2_3_bit;
at P2_4_bit;
at P2_5_bit;

char txt1[] = "amit prakash


singh"; char txt2[] = "digital
systems"; char txt3[] = "m.tech";
char txt4[] =
"mnnit"; char i;
void Move_Delay()
{ Delay_ms(500);
speed here
}
void main(){
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
LCD_Out(1,6,txt3);
LCD_Out(2,6,txt4);
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
LCD_Out(1,1,txt1);
LCD_Out(2,5,txt2);
Delay_ms(2000);

while(1) {
for(i=0; i<8; i++) {
Lcd_Cmd(_LCD_SHIFT_LEFT);
Move_Delay();
}
for(i=0; i<8; i++) {
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}

// Loop variable
// Function used for text moving
// You can change the moving

//
//
//
//
//
//
//
//
//

Initialize LCD
Clear display
Cursor off
Write text in first row
Write text in second row
delay of 2 sec
Clear display
Write text in first row
Write text in second row

// Endless loop
// Move text to the
times //moving speed

left

// Move text to the right 7 times


//moving speed

}
}
7

You might also like