我的中断时使用两个,一个事外部中断PA8,另一个timer3产生10ms中断,设置如下:
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);//配置为:先占优先级(0-1),从优先级(0-7)
// Enable the EXTI9_5 Interrupt NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQChannel; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;//先占优先级 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;//从优先级 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQChannel; VIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure);
中断服务子程序如下: void EXTI9_5_IRQHandler(void) { if(EXTI_GetITStatus(EXTI_Line8) != RESET) {
delay_1ms(2000); } }
void TIM3_IRQHandler(void) { TIM_ClearITPendingBit(TIM3, TIM_IT_Update); //清中断 keyboard_proc(); if(++timer0_10ms_counter>50)//50*10ms=500ms { timer0_10ms_counter=0; update_display(); } }
从设置上看,我的timer3的中断优先级比PA8的外部中断优先级高,应该可以中断PA8的运行。我在PA8中断的开始和结束都设置一个断点(注意PA8中断中我故意加了一个2000ms的延时),在timer3的中断入口也设置了一个断点,按照预期的效果应该是timer3中断PA8中断,可是结果是没有中断PA8的中断
请问问题在哪?? 谢谢!!
|