u8 uc_rec[5]={0xAA,0x02,0x01,0x01,0xFF}; u8 uc_send[5];u8 uc_rec_pointers=0;u8 uc_send_pointers=0;void UsartInit() /*串口初始化*/{TMOD=0x20; /*T1:方式2,定时*/TH1=0xf4; /*设置初值*/TL1=0xf4; /*设置初值*/PCON=0x80; /*波特率翻倍*/TR1=1; /*启动T1定时器*/SCON=0x50; /*方式1*/ES=1; /*串行口中断允许*/EA=1; /*CPU中断允许*/}void Usart() interrupt 4{if(RI==1){uc_rec[uc_rec_pointers]=SBUF;uc_rec_pointers++;RI=0;SBUF=uc_rec[uc_rec_pointers];while(!TI);TI=0;if(uc_rec_pointers==5){uc_rec_pointers=0;}}}