/* Write a program to display string “ELECTRONICS” on LCD*/
#include<reg51.h>
Sfr ldata=0x80;
Sbit rs=P1^0;
Sbit en=P1^1;
Void MsDelay(unsigned int itime)
{
Unsigned int I,j;
For(i=0;i<time;i++)
For(j=0;j<1275;j++)
}
Void lcdcmd(unsigned char value)
{
ldata=value;
rs=0; //command register
en=1;
MsDelay(10);
en=0;
Return;
}
Void lcdcmd(unsigned char value)
{
ldata=value;
rs=0; //data register
en=1;
MsDelay(10);
en=0;
Return;
}
Void main()
{
Unsigned char text[]={“ELECTRONICS”};
Unsigned char x;
Lcdcmd(0x38); //2 lines 5*7 matrix
MsDelay(20);
Lcdcmd(0x0e); // display on cursor on
MsDelay(20);
lcdcmd(0x01); //clear display
MsDelay(20);
Lcdcmd(0x06); //shift cursor to right
MsDelay(20);
Lcdcmd(0x80); //move cursor to first line
MsDelay(20);
For(x=0;x<11;x++)
{
Lcddata(text[x]);
MsDelay(20);
}
While(1);
}