初级会员
- 积分
- 134
- 金钱
- 134
- 注册时间
- 2018-3-26
- 在线时间
- 286 小时
|
楼主 |
发表于 2021-3-30 13:37:23
|
显示全部楼层
void Uart1RxOneByte(void) //interrupt 16
{
if(SCON1 & 0x01)
{
SCON1 &= (~0x01);
Buf_Reci[WriteReci]=SBUF1;
if(WriteReci<BUFRECI)
{
WriteReci++;
}
SCON1 &= (~0x01);
if((0xEE==Buf_Reci[0])&&(0xB1==Buf_Reci[1])&&(0x04==Buf_Reci[6])&&(0x01==Buf_Reci[9])&&(0xFF==Buf_Reci[13]))
{
SPEAKER_CTL(ON);
msDelay(1000);
// SetTextInt32(0,2,1,1,1);
//SBUF1=0X01;
WriteReci=0;
//while((SCON1 & 0x02) ==0);
//SCON1 &= (~0x02);
Buf_Reci[13]=0;
}
else if((0xEE==Buf_Reci[0])&&(0xB1==Buf_Reci[1])&&(0x04==Buf_Reci[6])&&(0x00==Buf_Reci[9])&&(0xFF==Buf_Reci[13]))
{
SPEAKER_CTL(OFF);
msDelay(1000);
// SetTextInt32(0,2,1,1,1);
// SBUF1=0X02;
// while(!(SCON1 & 0x02));
// SCON1 &= (~0x02);
WriteReci=0;
Buf_Reci[13]=0;
}
else if((0xEE==Buf_Reci[0])&&(0xB1==Buf_Reci[1])&&(0x05==Buf_Reci[6])&&(0x01==Buf_Reci[9])&&(0xFF==Buf_Reci[13]))
{
SPEAKER_CTL(OFF);
msDelay(1000);
//SBUF1=0X03;
//while(!(SCON1 & 0x02));
//SCON1 &= (~0x02);
WriteReci=0;
Buf_Reci[13]=0;
}
else if((0xEE==Buf_Reci[0])&&(0xB1==Buf_Reci[1])&&(0x05==Buf_Reci[6])&&(0x00==Buf_Reci[9])&&(0xFF==Buf_Reci[13]))
{
SPEAKER_CTL(ON);
msDelay(1000);
//SBUF1=0X04;
//while(!(SCON1 & 0x02));
//SCON1 &= (~0x02);
WriteReci=0;
Buf_Reci[13]=0;
}
}
}
|
|