| void USART_SendProcess(u8 uartNum) {
 if(txDataCount[uartNum]<txDataLength[uartNum])
 {
 USART_SendData(uartX[uartNum],uartTxbuffer[uartNum][txDataCount[uartNum]]);
 txDataCount[uartNum]++;
 }
 else
 {
 USART_ITConfig(uartX[uartNum], USART_IT_TXE, DISABLE);
 if(uartNum==RS485I)
 {
 EN485I(0);
 }else if(uartNum==RS485II)
 {
 EN485II(0);
 }
 USART_ITConfig(uartX[uartNum], USART_IT_RXNE, ENABLE);//开启接收中断
 }
 
 }
 
 void USART2_IRQHandler(void)                        //串口2中断服务程序
 {
 OSIntEnter();
 if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET)
 {
 USART_ReceiveProcess(1);
 }
 if(USART_GetITStatus(USART2, USART_IT_TXE) != RESET)
 {
 USART_SendProcess(1);
 }
 if (USART_GetFlagStatus(USART2,USART_FLAG_ORE)==SET)
 {
 USART_ClearFlag(USART2,USART_FLAG_ORE);    //读SR
 USART_ReceiveData(USART2);                 //读DR
 }
 OSIntExit();
 }
 
 发送完成后一开启接收中断 程序就会进入一次接收中断函数 导致第一个数据是0 怎么解决。希望大神指正。
 |