现在用到STM8L152C6单片机做通信功能,但始终无法进入接收中断,为什么?请各位指教。
void Usart_Init(void)
{
CLK_PeripheralClockConfig(CLK_Peripheral_USART1, ENABLE);
USART_DeInit(USART1);
USART_Init( USART1,
BaudRate_9600,
USART_WordLength_8b,
USART_StopBits_1,
USART_Parity_No,
(USART_Mode_Rx)//
);
USART_ITConfig(USART1,USART_IT_TC,DISABLE);//关闭串口发送完中断
USART_ITConfig(USART1,USART_IT_TXE,DISABLE);//关闭串口发送中断
USART_ITConfig(USART1,USART_IT_RXNE ,ENABLE);//打开串口接收中断USART_IT_RXNE
USART_Cmd(USART1,ENABLE);
}
下面是接收中断函数
INTERRUPT_HANDLER(USART1_RX_IRQHandler,28)
{
dummy = USART1_DR;
}
|