interfacing_lcd1
interfacing_lcd1
01
DOP: DOS:
Project Members:
1) Prasad Pawaskar 58
2) Vishal Thakur 72
1
AIM: To interface LCD using 8051 microcontroller and displaying
characters (AT89C51).
A 16x2 LCD means it can display 16 characters per line and there
are 2 such lines. In this LCD each character is displayed in 5x7
pixel matrix. This LCD has two registers.
1. Command/Instruction Register- stores the command
instructions given to the LCD. A command is an instruction given
to LCD to do a predefined task like initializing, clearing the
screen, setting the cursor position, controlling display etc.
2. Data Register- stores the data to be displayed on the LCD. The
data is the ASCII value of the character to be displayed on the
LCD
2
Algorith Firstly, initialize all the ports.
m: Initialize the LCD to turn it ON and to a form that it is
ready to accept commands.
Now command the LCD to write.
Display the contents using the required functions.
#include<reg52.h>
//including sfr registers for ports of the controller
#include<lcd.h>
sbit RS = P0^0;
sbit EN = P0^1;
sbit D0 = P2^0;
sbit D1 = P2^1;
sbit D2 = P2^2;
sbit D3 = P2^3;
sbit D4 = P2^4;
sbit D5 = P2^5;
sbit D6 = P2^6;
sbit D7 = P2^7;
void Delay(int a)
int j;
int i;
3
for(i=0;i<a;i++)
for(j=0;j<100;j++)
void main()
int i;
Lcd8_init();
while(1)
Lcd8_Set_Cursor(1,1);
Lcd8_Write_String("ElectroSome Hello");
for(i=0;i<15;i++)
Delay(1000);
Lcd8_Shift_Left();
for(i=0;i<15;i++)
Delay(1000);
Lcd8_Shift_Right();
4
}
Lcd8_Clear();
Lcd8_Set_Cursor(2,1);
Lcd8_Write_Char('e');
Lcd8_Write_Char('S');
Delay(3000);
Output :