初级会员

- 积分
- 83
- 金钱
- 83
- 注册时间
- 2017-5-21
- 在线时间
- 18 小时
|
串口接收包含0x00数据,就会省略掉0x00
用串口助手直连设备发送:56 00 11 00 返回:76 00 11 00 0B 56 43 30 37 30 36 20 31 2E 30 30
用单片机发送:55 00 11 00 返回:76 11 0B 56 43 30 37 30 36 20 31 2E 30 30
请教各位前辈,是什么原因。
USART_SendData(USART2,0x56);
delay_ms(1);
USART_SendData(USART2,0x00);
delay_ms(1);
USART_SendData(USART2,0x11);
delay_ms(1);
USART_SendData(USART2,0x00);
delay_ms(1);
void USART2_IRQHandler(void) //串口2中断服务程序
{
u8 Res, i;
if (USART_GetITStatus(USART2, USART_IT_RXNE) != RESET) //接收中断
{
Res = USART_ReceiveData(USART2); //(USART2->DR); //读取接收到的数据
u1_printf("%c", Res);
}
}
|
|