SPWM输入捕获模式测方波周期问题、求高手!

2019-03-23 20:21发布

SPWM输入捕获模式测方波周期,中断程序如下: void TIM8_CC_IRQHandler(void)
{
if (TIM_GetITStatus(TIM8, TIM_IT_CC1) != RESET)
{              
/* Clear TIM3 Capture compare interrupt pending bit */
  TIM_ClearITPendingBit(TIM8, TIM_IT_CC2);
  GPIO_ResetBits(GPIOC,GPIO_Pin_13) ;   /* Get the Input Capture value */
  IC2Value = TIM_GetCapture2(TIM8);   if (IC2Value != 0)
  {
    /* Duty cycle computation*/
   // DutyCycle = (TIM_GetCapture1(TIM3) * 100) / IC2Value;     /* Frequency computation*/
    Frequency = SystemCoreClock / IC2Value;
  }
  else
  {
    //DutyCycle = 0;
    Frequency = 0;
  }
  }   请问测量出来的频率怎么看是否与输入的方波频率一致呢?在哪里可以观察到数据呢? 此帖出自小平头技术问答
0条回答

一周热门 更多>