STM32 NVIC 中断嵌套

2019-03-23 19:43发布

void NVIC_Configuration(void)
{
  NVIC_InitTypeDef NVIC_InitStructure;
    NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x00000);
  
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
#ifdef USE_USART2
  NVIC_InitStructure.NVIC_IRQChannel = EVAL_COM1_IRQn;
#else
  NVIC_InitStructure.NVIC_IRQChannel = EVAL_COM2_IRQn;
#endif
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
}

void NVIC_Configuration_RTC(void)
{
  NVIC_InitTypeDef NVIC_InitStructure;
  NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
}
//这样写是中断嵌套么  在测试的时候 发现 不是我要的结果啊
还是说 应该写在一个函数里
com2 抢占有限0    RTC抢占优先 2  
执行的时候 不正确  应该是RTC被com2 打断 后 com2中断完成后 会回到rtc
但是现在不行哦  
在RTC里 do while 此帖出自小平头技术问答
0条回答

一周热门 更多>