Interfacing A LCD Display With 8051
Interfacing A LCD Display With 8051
character on LCD
LCD is a very commonly used output device to display alphanumeric characters. The LCD
displays the character corresponding to the data received on its input data port i.e., it treats
the data as the ASCII value of the character to be displayed. So if the value 65 is given to its
data port the character “A” will be displayed and if the value 49 is given to the LCD the
numeric digit “1” will be displayed. At many instances it is required to display a number like
123 on LCD. Displaying this number is tricky. If the data port of the LCD is loaded with the
number 123, then the character corresponding to it will be displayed.
1 - GND
2 - VCC (+5V)
3 - VEE (FOR CONTRAST)
4 - RS (REGISTER SELECT)
5 - RW (READ/WRITE)
6 - EN (ENABLE)
7-14 - DATA PINS D0-D7
15 - LED PLUS
16 - LED MINUS
Components required:-
Pin Function:-
#include<reg51.h>
/****************************************
*****************************************/
for(i=0;i<xtime;i++)
for(j=0;j<1275;j++);
/****************************************
*****************************************/
{
ldata = value; // value is copied to ldata
/****************************************
*****************************************/
ldata=value;
RW=0;
EN=1;
delay_ms(1);
EN=0;
/****************************************
*****************************************/
void initialize_lcd()
delay_ms(10);
delay_ms(10);
delay_ms(10);
delay_ms(10);
for(z=0;z<11;z++)
while(1)
for(z=0xCF;z>=0xC4;z--)
{
lcdcmd(z);
for( m=0;m<14;m++)
lcddata(mess2[m]);
delay_ms(100);
for(z=0xCF;z>=0xC0;z--)
lcdcmd(z);
for( m=0;m<16;m++)
lcddata(mess4[m]);
delay_ms(100);
lcdcmd(0xc8);
lcddata('&');
delay_ms(100);
lcdcmd(0xc8);
lcddata(' ');
delay_ms(100);
for(z=0xCF;z>=0xC2;z--)
{
lcdcmd(z);
for( m=0;m<14;m++)
lcddata(mess3[m]);
delay_ms(100);
for(z=0xCF;z>=0xC0;z--)
lcdcmd(z);
for( m=0;m<16;m++)
lcddata(mess4[m]);