本帖最后由 kangbin334 于 2015-9-4 21:39 编辑
#include "stm32f10x.h"
#include "led.h"
#include "delay.h"
#include "stm32f10x_exti.h"
#include "stm32f10x_it.h"
int main(void)
{
led_init();
delay_init();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);
GPIO_EventOutputConfig(GPIO_PortSourceGPIOD,GPIO_PinSource0);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
EXTI_InitTypeDef aaa;
aaa.EXTI_Line=EXTI_Line0;
aaa.EXTI_LineCmd=ENABLE;
aaa.EXTI_Mode=EXTI_Mode_Interrupt;
aaa.EXTI_Trigger=EXTI_Trigger_Falling;
EXTI_Init(&aaa);
NVIC_InitTypeDef bbb;
bbb.NVIC_IRQChannel=EXTI0_IRQn;
bbb.NVIC_IRQChannelCmd=ENABLE;
bbb.NVIC_IRQChannelPreemptionPriority=0;
bbb.NVIC_IRQChannelSubPriority=0;
NVIC_Init(&bbb);
EXTI_ClearITPendingBit(EXTI_Line0);
while(1);
}
void EXTI0_IRQHandler(void)
{
GPIOF->ODR=0xfffd;
EXTI_ClearFlag(EXTI_Line0);
EXTI_ClearITPendingBit(EXTI_Line0);
}
一个很简单的进中断里点亮一个灯的实验,但是只有GPIOA可以进中断,其他的B,C,D,等等都进不了中断,这是怎么回事啊?只要把字母“A”改成别的字母就进不了中断了。 |