void USART2_IRQHandler(void) //串口2中断服务程序
{ u8 res;
if(USART_GetITStatus(USART2,USART_IT_RXNE)!=RESET)
{
USART_ClearITPendingBit(USART2,USART_IT_RXNE);
res=USART_ReceiveData(USART2); //读接收到的字节,同时相关标志自动清除
if(jiguang.ReceiveFlag==0){
if(jiguang.Flag_odd==0){
//LED1=0;
if((jiguang.Receive_PP ==0xB4) && (res==0x69)){
jiguang.Flag_odd=1;
}
jiguang.Receive_PP=res;
}
if(jiguang.Flag_odd==1){
jiguang.ReceiveBuffer[point]=res;
point++;
}
if(point==8){
jiguang.Flag_odd=0;
point=1;
jiguang.Receive_PP =0;
jiguang.ReceiveFlag=1;
jiguang.ReceiveBuffer[0]=0xB4;
}
}
}
}
这是我的串口中断函数,是因为哪个地方出现错误了么!! |