TIM_ITConfig(TIM1,TIM_IT_CC4, ENABLE);//前
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
NVIC_InitStructure.NVIC_IRQChannel = TIM1_CC_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
TIM_ITConfig(TIM1,TIM_IT_CC4, ENABLE);//后
TIM_ITConfig(TIM1,TIM_IT_CC4, ENABLE);//这句话放前放后的区别在哪? 我发现放前面中断就异常了。
|