下降沿触发中断配置函数
void EXTI_INtConfig(u32 Pin)
{
EXTI_InitTypeDef EXTI_InitStructure;
EXTI_ClearITPendingBit( Pin ); //PA8
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Line = Pin ;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
}
开EXTI2_IRQChannel设置为下降沿触发
NVIC_InitStructure.NVIC_IRQChannel =EXTI2_IRQChannel; // 2 中断
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_Init(&NVIC_InitStructure);
EXTI_INtConfig(HOPP_XX_IN_INt);
io口设置为下拉复用GPIO_Mode_IPD 模式
有时候很准确,有时候多算了几个中断, 加示波器看 波形是没问题,用jlink 调试 发现有时候上升沿也能触发中断。。。
何解,何解
|
|