PA08设置为TIM3_CH0A, 设置上升沿和下降沿捕捉中断,但是中断后没有相关上升沿和下降沿的中断标志,应该怎么判断?代码如下:
void Tim3_IRQHandler(void)
{
static uint8_t i;
//Timer3 捕获中断A
if(TRUE == Tim3_GetIntFlag(Tim3CA0Irq))
{
if(0 == i)
{
Tim3_Capture_Value1 = M0P_TIM3_MODE23->CCR0A_f.CCR0A; //第一次读取捕获值
Tim3_Uev_Cnt = 0;
i++;
}
else
{
Tim3_Capure_Value2 = M0P_TIM3_MODE23->CCR0A_f.CCR0A; //第二次读取捕获值
Tim3_Capture_Value = Tim3_Uev_Cnt * 0xFFFF + Tim3_Capure_Value2 - Tim3_Capture_Value1; //两次捕获之间的差值
Tim3_Uev_Cnt = 0;
i = 0;
}
Tim3_ClearIntFlag(Tim3CA0Irq); //清中断标志
}
//timer3计数溢出中断
if(TRUE == Tim3_GetIntFlag(Tim3UevIrq))
{
Tim3_Uev_Cnt++;
Tim3_ClearIntFlag(Tim3UevIrq);
}
}
|