#include
#define uchar unsigned char
#define uint unsigned int
uchar flag,i;
uchar rec[3]={0};
void delay()
{
int i,j;
for(i=0;i<255;i++)
for(j=0;j<255;j++);
}
void init()
{
TMOD=0x20;
TH1=0xfd;
TL1=0xfd;
TR1=1;
REN=1;
SM0=0;
SM1=1;
EA=1;
ES=1;
}
void main()
{
init();
while(1)
{
if(flag==1)
{ flag=0;
//i=1;
ES=0;
SBUF = rec[0];
while(!TI);
TI=0;
ES=1;
}
}
}
void ser() interrupt 4
{
//RI=0;
// a = SBUF;
// flag=1;
uchar temp=0;
//static uchar count =0;
if(RI)
{
RI = 0;
temp = SBUF;
rec[0]=temp;
//count=0;
flag=1;
//delay();
}
}