中断问题,执行NVIC_Init(&NVIC_InitStructure)使执行不下去

2019-03-23 19:28发布

程序如下:
void NVIC_Configuration(void)
{
#ifdef  VECT_TAB_RAM  
  /* Set the Vector Table base location at 0x20000000 */
  NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
#else  /* VECT_TAB_FLASH  */
  /* Set the Vector Table base location at 0x08000000 */
  NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);   
#endif
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); //设置中断优先级
  
  /*允许EXTI0、EXTI1、EXTI2中断 */
  NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQChannel;   //中断通道
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //强占优先级
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //次优先级
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //通道中断使能
  NVIC_Init(&NVIC_InitStructure);       //初始化中断
  
  /*允许EXTI1中断 */
  NVIC_InitStructure.NVIC_IRQChannel = EXTI3_IRQChannel;   //中断通道
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //强占优先级
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //次优先级
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //通道中断使能
  NVIC_Init(&NVIC_InitStructure);       //初始化中断*/
  
  /*允许EXTI2中断 */
  NVIC_InitStructure.NVIC_IRQChannel = EXTI2_IRQChannel;   //中断通道
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //强占优先级
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //次优先级
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //通道中断使能
  NVIC_Init(&NVIC_InitStructure);       //初始化中断*/
}
当执行到NVIC_Init(&NVIC_InitStructure)时就执行部下去了,不知道什么原因,麻烦高手指点一下,我用的芯片是STM32F100系列的。
并且通过单步调试进入NVIC_Init函数时,执行到下面的语句就执行不下去了。
NVIC->ISER[(NVIC_InitStruct->NVIC_IRQChannel >> 0x05)] =
      (u32)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (u8)0x1F);

麻烦有碰到过该问题的朋友给我一些建议。谢谢!!! 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。