void USARTy_IRQHandler(void)
{
if(USART_GetITStatus(USARTy, USART_IT_RXNE) != RESET)
{
/* Read one byte from the receive data register */
RxBuffer1[RxCounter1++] = USART_ReceiveData(USARTy);
if(RxCounter1 == NbrOfDataToRead1)
{
/* Disable the USARTy Receive interrupt */
USART_ITConfig(USARTy, USART_IT_RXNE, DISABLE);
}
}
if(USART_GetITStatus(USARTy, USART_IT_TXE) != RESET)
{
/* Write one byte to the transmit data register */
USART_SendData(USARTy, TxBuffer1[TxCounter1++]);
if(TxCounter1 == NbrOfDataToTransfer1)
{
/* Disable the USARTy Transmit interrupt */
USART_ITConfig(USARTy, USART_IT_TXE, DISABLE);
}
}
}
中断的代码就是这样子的,USARTy就是USART1,这是网上找的~~
感觉代码应该没错,但是好像是停在发数据跟接收数据的中断里了,用串口助手发数据,接收数据成功的指示灯也没有变化。难道还要另外设置东西吗?如那个boot0和boot1的?! |