This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

串口通信数据发送读取以及仿真问题



在串口通信问题中,数据的接收总感觉有问题,仿真时候也会出现如图所示的问题,这个应该怎么解决?

数据接收与传送在中断中进行

void UART0IntHandler(void)
{
uint32_t ui32Status = 0;

//获取中断状态
ui32Status = UARTIntStatus(UART0_BASE, true);

//清除中断标志
ROM_UARTIntClear(UART0_BASE, ui32Status);

RxData[UartTxLen++]=UARTCharGet(UART0_BASE);

if(UartTxLen==9)
{
UartTxLen=0;
for(UartTxIndex=0;UartTxIndex<9;UartTxIndex++)
{
UARTCharPutNonBlocking(UART0_BASE,RxData[UartTxIndex]);
RxData[UartTxIndex]=0;
}
UARTprintf("\nOK\n");
}
}

上位机发出的数据为abcdefg  而仿真接收的数据为

而整个程序正常跑起来,上位机看到的数据为

感觉到数据有规律的错位了,不知道是不是读取串口数据有问题,还是串口通信没有调好?