程序运行时总是进不了中断,不知道是哪里设置的问题,是不是少了什么内容,求高手指点一二,谢谢!
void EXTI_Init(void)
{
SCB->AIRCR = 0x05AF0000 | 0x400; //中断优先级分组 抢占:响应=3:1
RCC->AHB1ENR |= (1<<1); //使能GPIOB 时钟
RCC->APB2ENR |= (1<<14);//使能syscfg 时钟
GPIOB->MODER &= ~(3<<4);//PB4输入
GPIOB->MODER &= ~(3<<5);//PB5输入
GPIOB->OSPEEDR |= (3<<4); //PB4 速度100m
GPIOB->OSPEEDR |= (3<<5); //PB5 速度100m
SYSCFG->CMPCR |= (1<<0); //使用IO 补偿单元
GPIOB-&gtUPDR &= ~(0xf<<8);//PB4,PB5 无上拉下拉
EXTI->IMR |= ( 3 << 4 ); //不屏蔽外中断线4,5
EXTI->FTSR |= ( 3 << 4 ); //中断线4,5下降沿触发
SYSCFG->EXTICR[1] &= 0xFFFFFF11; //配置外中断线4,5到PB口
NVIC->IP[EXTI4_IRQn] = 0xe0; //1110
NVIC->IP[EXTI9_5_IRQn] = 0xc0;//1100
NVIC->ISER[0] |= (1<<10); //使能外中断4
NVIC->ISER[0] |= (1<<23); //使能外中断9——5
} |