#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uint a,b;
uchar TAB[3]={0xff,0xff,0xff};
uchar table1[3][8]={{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07},{0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27},{0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}};
void main()
{
uchar j;
TMOD=0x20;
TR1=1;
TH1=0xFD;
TL1=0xFD;
SCON=0x50;
IE=0x90;
EA = 1;
while(1)
{
for(j=0;j<8;j++)
{
if(TAB[1]==table1[0][j])
{
if(TAB[0]==table1[1][j])
{
//
SBUF=TAB[0];
P2=table1[2][j];
//
while(!TI);
//
TI = 0;
}
}
}
}
}
void aaa() interrupt 4
{
static uchar i = 0; //定义为静态变量,当重新进入这个子函数时 i 的值不会发生改变
//
EA = 0;
if(RI == 1)
//当硬件接收到一个数据时,RI会置位
{
TAB = SBUF;
i++;
RI = 0;
if(i>1) i=0;
}
}
这个程序刚下载完运行正常 怎么断电后再打开 程序救不运行了呢?? |