初级会员
- 积分
- 101
- 金钱
- 101
- 注册时间
- 2018-1-16
- 在线时间
- 74 小时
|
楼主 |
发表于 2018-3-26 20:31:21
|
显示全部楼层
本帖最后由 Miracle223 于 2018-3-26 20:33 编辑
试了一下 还是不能进入中断。 用printf观察到IRQ引脚有高低变化,但是还是进入不了中断。。(时钟已经在别的函数里打开)
[mw_shl_code=applescript,true] /* CE(PB10) IRQ(PB11) CS(PB12) SCK(PB13) SPI_MISO(PB14) SPI_MOSI(PB15) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//普通输出模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//100MHz
GPIO_Init(GPIOB, &GPIO_InitStructure);//初始化PG6,7
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;//普通输出模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//100MHz
GPIO_Init(GPIOB, &GPIO_InitStructure);//初始化PG6,7
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//100MHz
GPIO_Init(GPIOB, &GPIO_InitStructure);//初始化PB14
[/mw_shl_code]
[mw_shl_code=applescript,true] EXTI_InitTypeDef EXTI_InitStructure;
EXTI_InitStructure.EXTI_Line=EXTI_Line11; //使能外部中断线5
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; //外部中断
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //下降沿触发
EXTI_InitStructure.EXTI_LineCmd = ENABLE; //中断线使能
EXTI_Init(&EXTI_InitStructure);
[/mw_shl_code]
[mw_shl_code=applescript,true] NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; //串口中断
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //抢占优先级0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; //子优先级为0
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能
NVIC_Init(&NVIC_InitStructure);
[/mw_shl_code]
[mw_shl_code=applescript,true]void EXTI15_10_Handler()
{
SystemInit();
printf("22243436554");
EXTI_ClearITPendingBit(EXTI_Line11);
}
[/mw_shl_code]
|
|