//串口发送
void sendChar(char *p)//调用前关中止,调用完成后关中止{while(*p != \0){SBUF = *Pwhile(!TI);TI = 0;p++;}}
//串口接纳
//串口初始化
void series_init(){SCON = 0x50; //串口工作方式1,答应承受TMOD = 0x20; //守时器T1工作方式2TH1 = 0xfd;TL1 = 0xfd; //守时初值PCON &= 0x00; //smod = 0TR1 = 1; //敞开守时器1EA = 1;ES = 1; //开总中止可串行终端}
unsigned char ReceiveBuf;//串行中止服务函数void series() interrupt 4{RI = 0;ReceiveBuf = SBUF;/*do something;*/}