STM8S207R8T6的串口3不能实现接收中断,我用的是IAR库函数版本,内部16M晶振,编译没有问题,各位大神帮给我看看哪里出问题了,附件是我的工程文件
void main(void)
{
UART_Init(); //初始化UART
Send_Str("STM8S UART 实验!
");//发送字符串
enableInterrupts(); //开启中断
while (1)
{
}
}
void UART_Init(void)
{
UART3_DeInit();
UART3_Init((u32)9600, UART3_WORDLENGTH_8D, UART3_STOPBITS_1, UART3_PARITY_NO, UART3_MODE_TXRX_ENABLE);
UART3_ITConfig(UART3_IT_RXNE_OR, ENABLE);
UART3_Cmd(ENABLE);
enableInterrupts();
}
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
//UART3_ClearITPendingBit(UART3_IT_RXNE);
UART3_SendData8(UART3_ReceiveData8());
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>