首先选择好串口

①  第三项的配置

stm32 通过 stm32 cubemx 配置 串口中断

② 第三项

stm32 通过 stm32 cubemx 配置 串口中断

③串口的全局中断

stm32 通过 stm32 cubemx 配置 串口中断

stm32 通过 stm32 cubemx 配置 串口中断

④部分代码:

voidHAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)

{

    if(HAL_UART_Receive_IT(&huart1,a1,1)!=HAL_OK)   //判断是否接受到电脑传输过来的数据,并放入到数组a1。

{

              Error_Handler();

    }else

    {  

       HAL_GPIO_EXTI_Callback(GPIO_PIN_6);

    }

   

   

}

 

voidHAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)//中断回调函数

{

  自己的代码;

 

}




相关文章:

  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2021-08-25
  • 2022-02-19
  • 2021-04-19
  • 2021-08-10
  • 2022-01-08
猜你喜欢
  • 2021-05-11
  • 2021-07-22
  • 2021-09-16
  • 2021-06-23
  • 2021-11-19
  • 2021-07-07
相关资源
相似解决方案