中级会员
 
- 积分
- 354
- 金钱
- 354
- 注册时间
- 2016-4-12
- 在线时间
- 97 小时
|

楼主 |
发表于 2016-10-21 21:28:02
|
显示全部楼层
void USART1_IRQHandler(void)
{
u8 res;
// while (USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == RESET);
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) //½óêÕÖD¶Ï(½óêÕμ½μÄêy¾Y±ØDëêÇ0x0d 0x0a½áÎ2)
{
res =USART_ReceiveData(USART1);//(USART1->DR); //¶á衽óêÕμ½μÄêy¾Y
if( RX1_Cnt > 0)
{
RX1_Buffer[RX1_Cnt] = res;
RX1_Cnt++;
}
else if (res ==0x45)
{
RX1_Buffer[0] = res;
RX1_Cnt = 1;
}
if(RX1_Cnt >= 10)
{
if(RX1_Buffer[0]==0x45&&RX1_Buffer[1]==0x53&&RX1_Buffer[2]==0x50)
{
if(RX1_Buffer[4]==0x4C&&RX1_Buffer[5]==0x45&&RX1_Buffer[6]==0x44)
{
if(RX1_Buffer[7]==0x31)
{
if(RX1_Buffer[3]==0x4B) //éÏ
{
KeyNum=0;
}
if(RX1_Buffer[3]==0x47) //ÏÂ
{
KeyNum=1;
}
}
if(RX1_Buffer[7]==0x32)
{
if(RX1_Buffer[3]==0x4B) //×ó
{
KeyNum=2;
}
if(RX1_Buffer[3]==0x47) //óò
{
KeyNum=3;
}
}
if(RX1_Buffer[7]==0x33)
{
if(RX1_Buffer[3]==0x4B) //è·èÏ
{
KeyNum=4;
}
if(RX1_Buffer[3]==0x47) //·μ»Ø
{
KeyNum=5;
}
}
}
}
RX1_Cnt=0;
}
else
{
RX1_Cnt=0;
}
}
} |
|