各位大神大家好,
我现在用STM32F429串口发送AT指令给ZigBee模块,让串口再接收其返回数据,接收到的数据顺序不对且没有规律,请各位大神帮忙看下,谢谢~!
int main(void)
{
Debug_USART_Config();
//Usart_SendString( RS232_USART, (uint8_t *)"AT+GETINFO" );
while(1)
{
Usart_SendString( RS232_USART, (uint8_t *)"AT+GETINFO" );
//delay_nms(15);
Get_Pan_CH_ID();
delay_nms(20);
}
}
void Get_Pan_CH_ID()
{
//Usart_SendString( RS232_USART, (uint8_t *)"AT+GETINFO" );
if(Rxflag)
{
if (usRxCount < sizeof(ucaRxBuf01))
{
ucaRxBuf01[usRxCount++] = ucTemp;
}
else
{
usRxCount = 0;
}
Rxflag=0;
}
Pan_ID[0]=ucaRxBuf01[6];
Pan_ID[1]=ucaRxBuf01[7];
Pan_ID[2]=ucaRxBuf01[8];
Pan_ID[3]=ucaRxBuf01[9];
Pan_ID[4]=ucaRxBuf01[10];
Pan_ID[5]=ucaRxBuf01[11];
Pan_ID[6]=ucaRxBuf01[12];
Pan_ID[7]=ucaRxBuf01[13];
Ch_ID[0]=ucaRxBuf01[18];
Ch_ID[1]=ucaRxBuf01[19];
} |