例程中,中断内的代码如下:
void USART3_IRQHandler(void)
{
if(USART_GetITStatus(USART3, USART_INT_RDNE) != RESET)
{
/* Read one byte from the receive data register */
RxBuffer2[RxCounter2++] = USART_ReceiveData(USART3);
if(RxCounter2 == NbrOfDataToRead1)
{
/* Disable the USART3 Receive interrupt */
USART_INTConfig(USART3, USART_INT_RDNE, DISABLE);
}
}
if(USART_GetITStatus(USART3, USART_INT_TDE) != RESET)
{
/* Write one byte to the transmit data register */
USART_SendData(USART3, TxBuffer2[TxCounter2++]);
if(TxCounter2 == NbrOfDataToTransfer2)
{
/* Disable the USART3 Transmit interrupt */
USART_INTConfig(USART3, USART_INT_TDE, DISABLE);
}
}
}
难道不需要用USART_ClearFlag(USART3,USART_FLAG_RDNE),来清除中断标志吗?我尝试了清除中断标志,结果在中断内就出不来了
问题2:
调试USART2过程中,在串口中断内设置了断点,断点后全速运行,发现程序死在了中断内,一直在扫描中断,重新发了数据,才从中断中跳了出来。。。好奇怪呀 |