|
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit lcdrs=P3^4;
sbit en=P3^5;
sbit dula=P2^6;
sbit wela=P2^7;
void delay (uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void init()
{
dula=0;
wela=0;
lcdrs=0;
write_com(0x38);
write_com(0x0f);
write_com(0x26);
}
void write_com(uchar com)
{
lcdrs=0;
P0=com;
delay(5);
en=1;
delay(5);
en=0;
}
void writedat(uchar dat)
{ lcdrs=1;
P0=dat;
delay(5);
en=1;
delay(5);
en=0;
}
void main()
{
init();
while(1);
} 不理解 明明定义了 已经
|
|