|
发表于 2023-4-17 10:18:38
|
显示全部楼层
#include <reg51.h>
#include<absacc.h>
#define AD XBYTE[0xfefa]
sbit RS=P2^4;
sbit RW=P2^5;
sbit E=P2^6;
sbit Led=P2^7;
int b;
WriteCMD(unsigned char x)
{
int i;
RS=0;
RW=0;
P1=x;
E=1;
for(i=0;i<2000;i++);
E=0;
return x;
}
WriteDATA(unsigned char x)
{
int i;
RS=1;
RW=0;
P1=x;
E=1;
for(i=0;i<2000;i++);
E=0;
return x;
}
void LCDinit(void)
{
WriteCMD(0x01);
WriteCMD(0x38);
WriteCMD(0x3c);
WriteCMD(0x06);
}
change()interrupt 0
{
int j;
char a[]={"Light:b"};
b=AD;
for(j=0;j<9;j++)
{
WriteCMD(0xc1+j);
WriteDATA(a[j]);
while(1);
}
}
main()
{
EA=1;
EX0=1;
IT0=1;
LCDinit();
while(1)
{
AD=0;
}
} |
|