STM32之NVIC学习 -
[导读] NVIC_InitTypeDef NVIC_InitStructure; /* Configure the NVIC Preemption Priority Bits */ /* Configure one bit for preemption priority */ /*优先级组说明了抢占优先级所用的位数,和子优先级所用的位数在这里
NVIC_InitTypeDef NVIC_InitStructure;
本文引用地址: http://www.21ic.com/app/mcu/201807/781077.htm
/* Configure the NVIC Preemption Priority Bits */
/* Configure one bit for preemption priority */
/*优先级组说明了抢占优先级所用的位数,和子优先级所用的位数在这里是1,7 */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
/* Enable the USART1 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = UART5_IRQn; //设置串口5中断
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //抢占优先级0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //子优先级为0
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能
NVIC_Init(&NVIC_InitStructure);
其中IRQChannel在stm32f2xx.h中查找。UART5_IRQn为UART5中断通道。
查看评论 回复
"STM32之NVIC学习 -"的相关文章
- 上一篇:STM32定时器自学笔记
- 下一篇:单片机数码管显示消隐 -