#include<reg52.h>
#include<intrins.h>
#include<1602显示.h>
#define uchar unsigned char
#define uint unsigned int
uchar flag=1,i;
uchar code tablefa[8]={0x01,0x03,0x00,0x00,0x00,0x04,0x44,0x09};
uchar tableshou[13] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
void com1_init()
{
TMOD=0x20;
TH1=0xfd;
TL1=0xfd;
EA=1;
SM0=0;
SM1=1;
REN=1;
TR1=1;
}
void main()
{
lcd1602_init();
com1_init();
while(1)
{
if(flag==1)
{
ES=0;
xianshi1(tableshou);
Delay_1ms(2000);
for(i=0;i<8;i++)
{
SBUF=tablefa[i];
while(!TI);
TI=0;
}
flag=0;
ES=1;
}
}
}
void Com_Int(void) interrupt 4
{
uchar i=0;
for(i=0;i<13;i++)
{
tableshou[i] = SBUF;
}
if(i>12)
{
flag=1;
i=0;
}
RI=0;
} |