#include "at89x51.h"
sbit RS=P2^0;
sbit RW=P2^1;
sbit E=P2^2;
Delay(unsigned int count) //Delay
{
unsigned int i,j;
for (i=0; i<count; i++)
for (j=0; j<125; j++);
}
//*****************************************************
I_send(unsigned char y) //Send command
{
RS=0;
RW=0;
E=1;
P0=y;
Delay(1);
E=0;
}
//*****************************************************
D_send(unsigned char x) //Send data
{
RS=1;
RW=0;
E=1;
P0=x;
Delay(1);
E=0;
}
//*****************************************************
Start_lcd() //Initial LCD
{
Delay(15);
I_send(0x38);
Delay(6);
I_send(0x38);
Delay(1);
I_send(0x38);
I_send(0x01);
I_send(0x38);
I_send(0x08);
I_send(0x0c);
I_send(0x06);
}
main()
{
Start_lcd();
I_send(0x80);
D_send('1');
D_send('2');
D_send('3');
while(1)
{}
}