打印
[STM32F1]

stm2 tim2 ch1

[复制链接]
1491|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
lixglixg|  楼主 | 2014-3-27 12:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
STM, TI, ST
请教如何配置tim2 ch1为扑获输入
沙发
grant_jx| | 2014-3-27 17:17 | 只看该作者
去看固件库的例程
STM32F10x StdPeriph Lib v3.5.0\Project\STM32F10x_StdPeriph_Examples\TIM\InputCapture

This example shows how to use the TIM peripheral to measure the frequency of an
external signal.

The TIMxCLK frequency is set to SystemCoreClock (Hz), the Prescaler is 0 so the
TIM3 counter clock is SystemCoreClock (Hz).
SystemCoreClock is set to 72 MHz for Low-density, Medium-density, High-density
and Connectivity line devices. For Low-Density Value line and Medium-Density
Value line devices, SystemCoreClock is set to 24 MHz.

TIM3 is configured in Input Capture Mode: the external signal is connected to
TIM3 Channel2 used as input pin.
To measure the frequency we use the TIM3 CC2 interrupt request,
so In the TIM3_IRQHandler routine, the frequency of the external signal is computed.
The "TIM3Freq" variable contains the external signal frequency:
TIM3Freq = TIM3 counter clock / Capture in Hz,
where the Capture is the difference between two consecutive TIM3 captures.

For Low-density, Medium-density, High-density and Connectivity line devices,
the minimum frequency value to measure is 1100 Hz.
For Low-Density Value line, Medium-Density and High-Density Value line devices,
the minimum frequency value to measure is 366 Hz.

@par Directory contents

  - TIM/InputCapture/stm32f10x_conf.h    Library Configuration file
  - TIM/InputCapture/stm32f10x_it.c      Interrupt handlers
  - TIM/InputCapture/stm32f10x_it.h      Interrupt handlers header file
  - TIM/InputCapture/main.c              Main program
  - TIM/InputCapture/system_stm32f10x.c  STM32F10x system source file
  

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

28

主题

117

帖子

1

粉丝