STM32如何在我需要的时候关闭或打开外部中断EXTI? 10
我用这条指令EXTI->IMR&=~(EXTI_Line5)关闭了外部中断,后面用这条指令EXTI->IMR!=EXTI_Line5来打开外部中段,发现无法打开外部中断了...
我用这条指令 EXTI->IMR &= ~(EXTI_Line5) 关闭了外部中断,后面用这条指令 EXTI->IMR != EXTI_Line5 来打开外部中段,发现无法打开外部中断了,就是经不去中断了,求解!!!
好像我打开外部中断的语句错了,改成 EXTI->IMR |= EXTI_Line5 就可以了 展开
好像我打开外部中断的语句错了,改成 EXTI->IMR |= EXTI_Line5 就可以了 展开
2个回答
展开全部
那个中断已经被触发了,你要做的只有是清中断标志位:
EXTI_ClearITPendingBit(EXTI_Line14);
EXTI_ClearFlag(EXTI_Line14);
非要关的话,我觉得这样就关了
EXTI_InitStructure.EXTI_Line = EXTI_Line14;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = DISABLE; //ENABLE
EXTI_Init(&EXTI_InitStructure);
EXTI_ClearITPendingBit(EXTI_Line14);
EXTI_ClearFlag(EXTI_Line14);
非要关的话,我觉得这样就关了
EXTI_InitStructure.EXTI_Line = EXTI_Line14;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = DISABLE; //ENABLE
EXTI_Init(&EXTI_InitStructure);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询