以下程序是想发送一次然后接收一次,可结果是发送一次接收两次,该如何判断让它符合要求????????????????
unsigned char recv_char[30];
int i=0;
void UsartReceive(void)
{
if(USART_GetFlagStatus(USART1,USART_IT_RXNE)==SET)
{
USART_ClearFlag(USART1, USART_FLAG_RXNE | USART_FLAG_ORE);
recv_char= USART_ReceiveData(USART1);
i++;
}
if((recv_char[0] == 'F')&&(recv_char[1] == 'E')&&(recv_char[2] == 'F')&&(recv_char[3] == 'D')&&(recv_char[4] == 'A')&&(recv_char[5] == 'A')&&(recv_char[6] == 'A')&&(recv_char[7] == 'A')&&(recv_char[8] == 'A')&&(recv_char[9] == 'A'))
{
printf("%s\n","FEFDAA0000");
}
} |