u8 TIM5CH1_Capture_State=0;
u32 TIM5CH1_Capture_Value;
void TIM5_IRQHandler(void)
{
if((TIM5CH1_Capture_State&0X80)==0)
{
if(TIM_GetITStatus(TIM5,TIM_IT_Update)!= RESET)
{
if(TIM5CH1_Capture_State&0X40)
{
if((TIM5CH1_Capture_State&0X3F)==0X3F)
{
TIM5CH1_Capture_State|=0X80;
TIM5CH1_Capture_Value=0XFFFFFFFF;
}else TIM5CH1_Capture_State++;
}
}
if(TIM_GetITStatus(TIM5,TIM_IT_CC1)!= RESET)
{
if((TIM5CH1_Capture_State&0X40)==1)
{
TIM5CH1_Capture_State|=0X80;
TIM5CH1_Capture_Value=TIM_GetCapture1(TIM5);
TIM_OC1PolarityConfig(TIM5,TIM_ICPolarity_Rising);
}else
{
TIM5CH1_Capture_State=0;
TIM5CH1_Capture_Value=0;
TIM5CH1_Capture_State|=0X40;
TIM_Cmd(TIM5,DISABLE);
TIM_SetCounter(TIM5,0);
TIM_OC1PolarityConfig(TIM5,TIM_ICPolarity_Falling);
TIM_Cmd(TIM5,ENABLE );
}
}
}
TIM_ClearITPendingBit(TIM5,TIM_IT_Update|TIM_IT_CC1);
}
以上是本人参照原子代码写的,只不过定义的变量不同,可是编译后有两个错误,但是只要把我定义的两个变量TIM5CH1_Capture_State 和TIM5CH1_Capture_Value换成原子代码里的TIM5CH1_CAPTURE_STA和TIM5CH1_CAPTURE_VAL就没错误了,这是为什么?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>