用I/O做按键中断时候我选用PA11,PA12,PB8,PB9四个口做上拉输入作中断。 PA11,PA12中断成功,单是PB8,PB9用同样的方法确做不出来。
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQChannel; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource11|GPIO_PinSource12);///E………………无论设不设置此句,都是中断A口,把GPIO_PortSourceGPIOA改写成GPIO_PortSourceGPIOB 也是中断A口?????????????搞不明白????????????? /* Configure EXTI Line10 to generate an interrupt on falling edge */ EXTI_InitStructure.EXTI_Line = EXTI_Line11|EXTI_Line12; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising ; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); 在调试窗口外设查看窗显示的中断源一直是GPIOA, 当GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource11|GPIO_PinSource12);///应该显示GPIPOB才对 |