zoukankan      html  css  js  c++  java
  • [置顶] TIM_GetCounter与TIM_GetCapture1的区别


    /**
      * @brief  Gets the TIMx Input Capture 1 value.
      * @param  TIMx: where x can be 1 to 17 except 6 and 7 to select the TIM peripheral.
      * @retval Capture Compare 1 Register value.
      */
    uint16_t TIM_GetCapture1(TIM_TypeDef* TIMx)
    {
      /* Check the parameters */
      assert_param(IS_TIM_LIST8_PERIPH(TIMx));
      /* Get the Capture 1 Register value */
      return TIMx->CCR1;
    }

    /**
      * @brief  Gets the TIMx Counter value.
      * @param  TIMx: where x can be 1 to 17 to select the TIM peripheral.
      * @retval Counter Register value.
      */
    uint16_t TIM_GetCounter(TIM_TypeDef* TIMx)
    {
      /* Check the parameters */
      assert_param(IS_TIM_ALL_PERIPH(TIMx));
      /* Get the Counter Register value */
      return TIMx->CNT;
    }


    当捕获成功时,TIM_GetCapture1()和TIM_GetCounter()得到的值一样吗?
    TIM_GetCapture1对应寄存器CRR1,TIM_GetCounter对应寄存器CNT


    答:

    看你处理的速度了,
    正常来说TIM_GetCapture1才是最准确的.完全硬件级别的保存.

    捕获/比较寄存器 1: TIMx_CCR1,该寄存器用来存储捕获发生时, TIMx_CNT的值;

    我们从 TIMx_CCR1 就可以读出通道 1 捕获发生时刻的 TIMx_CNT 值









  • 相关阅读:
    贰、js的基础(二)类型转换
    贰、js的基础(一)
    ajax的异步请求小结
    壹、js的概述
    sass的用法小结(四)进阶篇
    sass的用法小结(三)
    sass的用法小结(二)
    sass的用法小结(一)
    H5页面在线制作工具搜集
    H5教程:移动页面性能优化
  • 原文地址:https://www.cnblogs.com/alan666/p/8311783.html
Copyright © 2011-2022 走看看