#include
***it E = P3^0;
***it RS = P3^1;
***it RW = P3^2;
***it CS1 = P3^3;
***it CS2 = P3^4 ;
#define uchar unsigned char
#define uint unsigned int
uchar code tab[] = {0x04,0x00,0x45,0x20,0x44,0xA8,0x2C,0x60,0x13,0xFE,0x1A,0x10,0x27,0x58,0x10,0x94,};
void delay(uchar x)
{
uchar i, j;
for(i = 0; i < x; i++)
for(j = 0; j <110; j++);
}
void write(uchar y, uint z)
{
RS = y;
RW = 0;
P2 = z;
delay(20);
E = 1;
delay(20);
E = 0;
}
void display(uchar h, uchar l)
{
write(0 , 0xb8);
write(0 , h);
write(0 , l);
}
void inte(void)
{
write(0 , 0x3f);
write(0 , 0x0f);
}
main()
{
uint i;
inte();
delay(5);
i = 0;
CS1 = 0;
CS2 = 0;
display(0xc0,0x40);
while(1)
{
write(1,tab);
i++;
}
while(1);
}
|