# include <at89x51.h>
# define LCDPort P1
#define RS P0_0;
#define RW P0_1;
#define EN P0_2;
void delay(int t)
{
int i;
while(t>0)
{
i=1275;
while(i>0) i--;
t--;
}
}
void LCDCommand(unsigned char Value)
{
RS=0; //here was the error//
RW=0;
LCDPort=Value;
EN=1;
delay(2);
EN=0;
return;
}
void LCDData(unsigned char Value)
{
RS=1;
RW=0;
LCDPort=Value;
EN=1;
delay(2);
EN=0;
return;
}
void LCDInit()
{
LCDCommand(0x38);
LCDCommand(0x06);
LCDCommand(0x0c);
LCDCommand(0x01);
}
LCDPuts(char *s)
{
int i;
for(i=0;s[i];i++) LCDData(s[i]);
}
void main()
{
LCDInit();
while(1)
{
LCDCommand(0x01);
delay(100);
LCDPuts("LCD TEST");
LCDCommand(0xc0);
LCDPuts("www.deas.in");
delay(100);
}
}