前三个中断正常运行,PB3的中断进入不了中断,求解答

2019-07-14 13:25发布

如题,PB3中断进入不了,为什么呢?求大神解答  
NVIC_InitTypeDef NVIC_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
    EXti_InitTypeDef EXTI_InitStructure;
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
   RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);//ÍⲿÖжϣ¬ÐèҪʹÄÜAFIOʱÖÓ
  // KEY_Init();//³õʼ»¯°´¼ü¶ÔÓ¦ioģʽ
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2| GPIO_Pin_3;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;         
    GPIO_Init(GPIOB,&GPIO_InitStructure);                                


    //GPIOB.1 ÖжÏÏßÒÔ¼°Öжϳõʼ»¯ÅäÖÃ
   GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource1);
   EXTI_InitStructure.EXTI_Line=EXTI_Line1;
   EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
   EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
   EXTI_InitStructure.EXTI_LineCmd = ENABLE;
   EXTI_Init(&EXTI_InitStructure);
    //GPIOB.2   ÖжÏÏßÒÔ¼°Öжϳõʼ»¯ÅäÖÃ
   GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource2);
   EXTI_InitStructure.EXTI_Line=EXTI_Line2;
   EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
   EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
   EXTI_InitStructure.EXTI_LineCmd = ENABLE;
   EXTI_Init(&EXTI_InitStructure);   
    //GPIOB.0   ÖжÏÏßÒÔ¼°Öжϳõʼ»¯ÅäÖÃ
   GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource0);
    EXTI_InitStructure.EXTI_Line=EXTI_Line0;
   EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
   EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
   EXTI_InitStructure.EXTI_LineCmd = ENABLE;
   EXTI_Init(&EXTI_InitStructure);  
  
    //GPIOB.3   ÖжÏÏßÒÔ¼°Öжϳõʼ»¯ÅäÖÃ
   GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource3);
    EXTI_InitStructure.EXTI_Line=EXTI_Line3;
   EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
   EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
   EXTI_InitStructure.EXTI_LineCmd = ENABLE;
   EXTI_Init(&EXTI_InitStructure);  


   NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;   
   NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02; //ÇÀÕ¼ÓÅÏȼ¶2
   NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x04;     //×ÓÓÅÏȼ¶1
   NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;        //ʹÄÜÍⲿÖжÏͨµÀ
   NVIC_Init(&NVIC_InitStructure);     //¸ù¾ÝNVIC_InitStructÖÐÖ¸¶¨µÄ²ÎÊý³õʼ»¯ÍâÉèNVIC¼Ä´æÆ÷
  
  NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn;   
   NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02;
   NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01;   
   NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;        
   NVIC_Init(&NVIC_InitStructure);


    NVIC_InitStructure.NVIC_IRQChannel = EXTI2_IRQn;   
   NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02;
   NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02;     
   NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;        
   NVIC_Init(&NVIC_InitStructure);
  
  NVIC_InitStructure.NVIC_IRQChannel = EXTI3_IRQn;   
   NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02;
   NVIC_InitStructure.NVIC_IRQChannelSubPriority =0x03;     
   NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;        
   NVIC_Init(&NVIC_InitStructure);



友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
6条回答
she558742
1楼-- · 2019-07-14 14:34
 精彩回答 2  元偷偷看……
cKin_g
2楼-- · 2019-07-14 14:55
she558742 发表于 2019-3-26 17:37

受教了,其实我是做JAVA的,公司有个项目急,赶鸭子上架。。。。。。刚刚接触几天。表示万分感谢。
she558742
3楼-- · 2019-07-14 18:04
cKin_g 发表于 2019-3-26 18:06
受教了,其实我是做JAVA的,公司有个项目急,赶鸭子上架。。。。。。刚刚接触几天。表示万分感谢。

。。。。
nyvvhxcs
4楼-- · 2019-07-14 20:42
晕,,,,,,,,,,
我叫张子轩
5楼-- · 2019-07-14 21:40
cKin_g 发表于 2019-3-26 18:06
受教了,其实我是做JAVA的,公司有个项目急,赶鸭子上架。。。。。。刚刚接触几天。表示万分感谢。

机会很好啊,做Java公司还给你机会做底层,好好把握啊!我一直想做这个,就是专业不对口!
iiiegsd
6楼-- · 2019-07-15 00:01
 精彩回答 2  元偷偷看……

一周热门 更多>