|
while(USART_GetFlagStatus(USART1, USART_FLAG_RXNE)==RESET);
a=USART_ReceiveData(USART1);
USART_SendData(USART1, a);
while( USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET );
while(USART_GetFlagStatus(USART1, USART_FLAG_RXNE)==RESET);
b=USART_ReceiveData(USART1);
USART_SendData(USART1, b);
while( USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET );
发送数据为21时
得到的数据啊a,b显示为如下:
【2014-08-21 19:43:47:058】BF 31
【2014-08-21 19:43:48:690】BB 31
【2014-08-21 19:43:50:075】72 31
【2014-08-21 19:43:51:698】BF 31
【2014-08-21 19:43:53:143】BA 31
而当如下时:
while(USART_GetFlagStatus(USART1, USART_FLAG_RXNE)==RESET);
a=USART_ReceiveData(USART1);
while(USART_GetFlagStatus(USART1, USART_FLAG_RXNE)==RESET);
b=USART_ReceiveData(USART1);
USART_SendData(USART1, a);
while( USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET );
USART_SendData(USART1, b);
while( USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET );
就输出为21
|
|