想在PB05设一个外部中断 EXTI_InitTypeDef EXTI_InitStructure;
/* Configure PB.05 as input floating (EXTI Line 5) */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource5); EXTI_ClearITPendingBit(EXTI_Line5);
EXTI_InitStructure.EXTI_Line = EXTI_Line5; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); 中断处理
void EXTI9_5_IRQHandler(void) { if(EXTI_GetITStatus(EXTI_Line5) != RESET) { /*----处理---*/ /* Clear the EXTI Line 5 */ EXTI_ClearITPendingBit(EXTI_Line5); } } 是这样设置的吗?我是不是忽略了某些东西?为什么进不去中断呢? |