[mw_shl_code=c,true]
[/mw_shl_code]
[mw_shl_code=c,true]if(tsr&0x02)//捕获1发生捕获事件
{
if(TIM5CH1_CAPTURE_STA&0X40) //捕获到一个下降沿
{
TIM5CH1_CAPTURE_STA|=0X80; //标记成功捕获到一次高电平脉宽
TIM5CH1_CAPTURE_VAL=TIM5->CCR1; //获取当前的捕获值.
printf("1:%lld us
",TIM5CH1_CAPTURE_VAL);
printf("2:%lld us
",TIM5CH1_CAPTURE_VAL);
printf("3:%lld us
",TIM5CH1_CAPTURE_VAL);
printf("4:%lld us
",TIM5CH1_CAPTURE_VAL);
printf("5:%lld us
",TIM5CH1_CAPTURE_VAL);
printf("6:%lld us
",TIM5CH1_CAPTURE_VAL);
printf("7:%lld us
",TIM5CH1_CAPTURE_VAL);
printf("8:%lld us
",TIM5CH1_CAPTURE_VAL);
TIM5->CCER&=~(1<<1); //CC1P=0 设置为上升沿捕获[/mw_shl_code] |