在线时间2 小时
UID378204
ST金币0
蝴蝶豆0
注册时间2012-8-8
新手上路
- 最后登录
- 2019-7-9
|
a0a.1 0b0c
这两天写程序,发现我的程序的中断嵌套有问题,优先级的顺序不对啊。中断初始化程序如下:
void ADC1_INT_Config(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
NVIC_InitStructure.NVIC_IRQChannel = ADC_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
ADC_ITConfig(ADC1, ADC_IT_EOC, ENABLE);
}
void TIM3_INT_Config(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
/* Enable the TIM3 gloabal Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x03;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE);
}
现在的问题是,TIM3的中断总是能够抢占ADC的中断。跟NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority 值设置大小没有关系啊!!!!
请知道的指教啊,谢谢! |
|