Parcourir la source

三相串口接收bug

liyi il y a 1 an
Parent
commit
b685bb6f99
1 fichiers modifiés avec 6 ajouts et 6 suppressions
  1. 6 6
      truing_control/PDU-Triphasic_IO/HARDWARE/Uart1/Uart1.c

+ 6 - 6
truing_control/PDU-Triphasic_IO/HARDWARE/Uart1/Uart1.c

@@ -89,12 +89,12 @@ void USART1_IRQHandler(void)
 			u8_RxBuf[u8_RX_Index] = usart_data_receive(USART1);     //将USART1接收到的数据保存到u8_RxBuf
 			u8_RX_Index++;
 			B_Rx_Data_ING = 1;																			// 置数据接收标志位
-		}
-    else
-		{
-			B_Rx_Finish = TRUE;										// 数据接收完毕
-			u8_RX_Index = 0;
-		}                                                                                     
+			if(u8_RX_Length == u8_RX_Index)
+			{
+				B_Rx_Finish = TRUE;
+				u8_RX_Index = 0;
+			}
+		}                                                                                
   }                                                                                                                                                                                                                                
 }