大神帮我看看下面程序哪错了???????
主要是当串口发送区发送FE FD AA AA AA到STM32F103,STM32F103接收到后就发送FE FD AA 00 00到串口接收区 ,可是下面程序串口接收区接收不到信息,这是为什么啊??????????????
int Uart1_Rx_Num=0;
char Uart1_Buffer[20];
int Uart1_Sta=0;
void UsartReceive(void)
{
if(USART_GetFlagStatus(USART1,USART_IT_RXNE)==SET)
{
USART_ClearFlag(USART1, USART_FLAG_RXNE | USART_FLAG_ORE);
Uart1_Buffer[Uart1_Rx_Num] = USART_ReceiveData(USART1);
Uart1_Rx_Num++;
}
if((Uart1_Buffer[0] == 0xFE)&&(Uart1_Buffer[1] == 0xFD)&&(Uart1_Buffer[2] == 0xAA)&&(Uart1_Buffer[3] == 0xAA)&&(Uart1_Buffer[4] == 0xAA))
{
Uart1_Sta=1;
}
if( Uart1_Sta )
{
USART_SendData(USART1, (uint32_t) "FE FD AA 00 00");
printf("%s\n","FE FD AA 00 00");
}
Uart1_Rx_Num = 0;
Uart1_Sta = 0;
even = E_GETCHAR;
} |