STM32/STM8技术论坛
直播中

寂寞的only

10年用户 346经验值
擅长:嵌入式技术 制造/封装 控制/MCU
私信 关注
[问答]

[中断]设置问题

  1. //参考手册上代码如下

    NVIC_InitTypeDef NVIC_InitStructure;

  2. /* Configure the Priority Grouping with 1 bit */
  3. NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);


  4. /* Enable tiM3 global interrupt with Preemption Priority 0 and SubPriority as 2 */
  5. NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQChannel;
  6. NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  7. NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
  8. NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  9. NVIC_InitStructure(&NVIC_InitStructure);


  10. /* Enable USART1 global interrupt with Preemption Priority 1 and SubPriority as 5 */
  11. NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQChannel;
  12. NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
  13. NVIC_InitStructure.NVIC_IRQChannelSubPriority = 5;
  14. NVIC_InitStructure(&NVIC_InitStructure);


  15. /* Enable RTC global interrupt with Preemption Priority 1 and SubPriority as 7 */
  16. NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQChannel;
  17. NVIC_InitStructure.NVIC_IRQChannelSubPriority = 7;
  18. NVIC_InitStructure(&NVIC_InitStructure);


  19. /* Enable EXTI4 interrupt with Preemption Priority 1 and SubPriority as 7 */
  20. NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQChannel;
  21. NVIC_InitStructure.NVIC_IRQChannelSubPriority = 7;
  22. NVIC_InitStructure(&NVIC_InitStructure);


  23. /* TIM3 interrupt priority is higher than USART1, RTC and EXTI4 interrupts priorities. USART1 interrupt priority is higher than RTC and EXTI4 interrupts priorities. RTC interrupt priority is higher than EXTI4 interrupt prioriy. */

这里最终是把RTC和TIM3都是设置成抢占优先级1,响应优先级7。
1.RTC interrupt priority is higher than EXTI4 interrupt prioriy.是不是错了?
2.global interrupt和普通中断有有什么区别吗?你是如何理解global interrupt的?
3.还有两个通道可以设置成一种优先级吗??


已退回5积分

回帖(1)

赵俊波

2015-10-14 20:19:37
两个通道如果设置成一样的优先级,中断同时触发时,就会根据中断向量表的优先级顺序进行响应
举报

更多回帖

发帖
×
20
完善资料,
赚取积分