STM32 USART串口中断

2019-03-23 19:05发布

 main(void)
  { 
  
/*
PC4  PC13 PB10 PA0
*/
  USART_InitTypeDef USART_InitStructure;
  USART_InitStructure.USART_BaudRate = 9600;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; USART_ITConfig(USART2,USART_IT_RXNE,ENABLE); STM_EVAL_COMInit(COM2, &USART_InitStructure); USART_Cmd(USART2,ENABLE);}     stm32f10x_it.c    void USART2_IRQHandler(void)
{
u16 c;
if (SET == USART_GetFlagStatus(USART2, USART_FLAG_RXNE))
{
c = USART_ReceiveData(USART2);
USART_SendData(USART2, c);
//GPIOD->ODR=0xffff;
printf("ddddeeee");
while (RESET == USART_GetFlagStatus(USART2, USART_FLAG_TC));
}
}   为什么不进入中断啊 我将程序下载到flash中用 串口调试助手发数据的 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。