野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 16330|回复: 4

TIM_GetCapture()和TIM_GetCounter()有什么区别

[复制链接]
发表于 2017-8-14 16:23:54 | 显示全部楼层 |阅读模式
  1. /**
  2.   * @brief  Gets the TIMx Input Capture 1 value.
  3.   * @param  TIMx: where x can be 1 to 14 except 6 and 7, to select the TIM peripheral.
  4.   * @retval Capture Compare 1 Register value.
  5.   */
  6. uint32_t TIM_GetCapture1(TIM_TypeDef* TIMx)
  7. {
  8.   /* Check the parameters */
  9.   assert_param(IS_TIM_LIST1_PERIPH(TIMx));

  10.   /* Get the Capture 1 Register value */
  11.   return TIMx->CCR1;
  12. }
复制代码
TIM_GetCapture1();
  1. /**
  2.   * @brief  Gets the TIMx Counter value.
  3.   * @param  TIMx: where x can be 1 to 14 to select the TIM peripheral.
  4.   * @retval Counter Register value
  5.   */
  6. uint32_t TIM_GetCounter(TIM_TypeDef* TIMx)
  7. {
  8.   /* Check the parameters */
  9.   assert_param(IS_TIM_ALL_PERIPH(TIMx));

  10.   /* Get the Counter Register value */
  11.   return TIMx->CNT;
  12. }
复制代码
TIM_GetCounter();



请问一下,在输入捕获模式下,这两个函数都是计数,有什么区别么?

回复

使用道具 举报

发表于 2017-8-14 17:12:47 | 显示全部楼层
在输入捕获模式下,计数器CNT开始计数,当捕获到信号的时候,CNT的值自动被锁存到CCR。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-8-14 17:34:55 | 显示全部楼层
fire 发表于 2017-8-14 17:12
在输入捕获模式下,计数器CNT开始计数,当捕获到信号的时候,CNT的值自动被锁存到CCR。

谢谢火哥!在输入捕获模式下,两个函数计数结果应该相同吧?
回复 支持 反对

使用道具 举报

发表于 2017-8-14 17:47:47 | 显示全部楼层
uStopRxy 发表于 2017-8-14 17:34
谢谢火哥!在输入捕获模式下,两个函数计数结果应该相同吧?

相同              
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-8-14 17:48:22 | 显示全部楼层

谢谢火哥
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-9-22 23:27 , Processed in 0.064804 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表