我用两个管脚设置为外部触发 然后使LED闪烁 但是即使我把他们的中断触发方式设置不同的 小灯闪烁的效果完全一样 ,下面是我的相关设置 ,请哪位大侠帮忙看下:
void EXIT_init(void)
{
//Ex_NVIC_Config(GPIOB,10,FTIR);//下降沿触发
//配置外部中断5
EXTI_ClearITPendingBit(EXTI_Line5);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource5);//选择中断管脚
EXIT_InitStructure.EXTI_Line=EXTI_Line5; //选择中断线路
EXIT_InitStructure.EXTI_Mode=EXTI_Mode_Interrupt; //选择为中断请求
EXIT_InitStructure.EXTI_Trigger=EXTI_Trigger_Falling; 设置为下降沿触发
//EXIT_InitStructure.EXTI_Trigger=EXTI_Trigger_Rising;
EXIT_InitStructure.EXTI_LineCmd=ENABLE;
EXTI_Init(&EXIT_InitStructure);
//配置外部中断5
EXTI_ClearITPendingBit(EXTI_Line10);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource10);
EXIT_InitStructure.EXTI_Line=EXTI_Line10;
EXIT_InitStructure.EXTI_Mode=EXTI_Mode_Interrupt;
EXIT_InitStructure.EXTI_Trigger= EXTI_Trigger_Rising_Falling; 上升下降都触发(改成其他方式也一样,比如上升)
EXIT_InitStructure.EXTI_LineCmd=ENABLE;
EXTI_Init(&EXIT_InitStructure);
}
此帖出自
小平头技术问答
一周热门 更多>