#include<reg52.h>
#define ldata P1 //16x2 lcd data pins to port p1
sbit en = P2^2;
sbit busy = P1^7;
sbit rs = P2^0;
sbit rw = P2^1;
void lcdcmd(unsigned char l);
void lcddata(unsigned char l);
void MSDelay(unsigned int t);
void lcdready();
void main()
{
while(1)
{
unsigned char message[] = "Hey.. ;) My$elF Tushki7 :)";
unsigned char z,l;
lcdcmd(0x38);
lcdcmd(0x0E);
lcdcmd(0x01);
lcdcmd(0x06);
for(z=0;z<25;z++)
{
l = message[z];
lcddata(l);
MSDelay(1275);
}
}
}
void lcdcmd(unsigned char l)
{
lcdready();
ldata = l;
rs = 0;
rw = 0;
en = 1;
MSDelay(1);
en = 0;
return;
}
void lcddata(unsigned char l)
{ lcdready();
ldata = l;
rs = 1;
rw = 0;
en = 1;
MSDelay(1);
en = 0;
return;
}
void lcdready()
{
busy = 1;
rs = 0;
rw = 1;
while(busy==1)
{
en = 0;
MSDelay(1);
en = 1;
}
return;
}
void MSDelay(unsigned int t)
{
unsigned int i,j;
for(i=0;i<t;i++)
{
for(j=0;j<50;j++)
{}
}
}