学前班
最后登录1970-1-1
在线时间 小时
注册时间2016-4-19
|
void TIM2_IRQHandler(void)
{
if (TIM_GetITStatus(TIM2, TIM_IT_CC1) != RESET)//2¶»ñ1·¢éú2¶»ñê¼t
{ TIM2CC1++;
if(TIM1OFF)
{TIM2CH1_CAPTURE_VAL=TIM2CC1;
TIM2CC1=0;
}
TIM_ClearITPendingBit(TIM2, TIM_IT_CC1 );//Çå3yÖD¶Ï±ê־λ
}
if (TIM_GetITStatus(TIM2, TIM_IT_CC2) != RESET)//2¶»ñ2·¢éú2¶»ñê¼t
{ TIM2CC2++;
if(TIM1OFF)
{TIM2CH2_CAPTURE_VAL=TIM2CC2;
TIM2CC2=0;
}
TIM_ClearITPendingBit(TIM2, TIM_IT_CC2 );
}
if (TIM_GetITStatus(TIM2, TIM_IT_CC3) != RESET)//2¶»ñ3·¢éú2¶»ñê¼t
{ TIM2CC3++;
if(TIM1OFF)
{TIM2CH3_CAPTURE_VAL=TIM2CC3;
TIM2CC3=0;
}
TIM_ClearITPendingBit(TIM2, TIM_IT_CC3 );
}
if (TIM_GetITStatus(TIM2, TIM_IT_CC2) != RESET)//2¶»ñ3·¢éú2¶»ñê¼t
{ TIM2CC2++;
if(TIM1OFF)
{TIM2CH4_CAPTURE_VAL=TIM2CC4;
TIM2CC4=0;
}
TIM_ClearITPendingBit(TIM2, TIM_IT_CC4);//Çå3yÖD¶Ï±ê־λ
}
}
如果由TIM_IT_CC1触发中断正在执行还没结束,|TIM_IT_CC2又触发了MCU会怎样处理? 同一中断函数void TIM2_IRQHandler(void)被不同的中断源在同一时刻触发(TIM2, TIM_IT_CC1|TIM_IT_CC2|TIM_IT_CC3|TIM_IT_CC4);|TIM_IT_CC4 )有没有优先级?
|
|