-
example6_TIM
本例展示了如何设置TIM,用它来测量一个外部输入信号的频率和占空比。
TIM2时钟设置为72MHz,预分频设置为0,TIM2计数器时钟可表达为:
TIM2 counter clock = TIMxCLK / (Prescaler +1) = 72 MHz,因此可测量的最小频率值为1100Hz。
设置TIM2工作在PWM输入模式(PWM Input Mode),把外部信号作为输入连接到TIM2通道2。
利用TIM2计数器中断来测量信号的频率和占空比。在TIM2_IRQHandler中,计算信号的频率和占空比,方法如下:
变量"Frequency"为由下式得到的外部信号频率:
Frequency = TIM2 counter clock / TIM2_CCR2 单位Hz
变量"Duty_Cycle"为由下式得到的外部信号占空比:
Duty_Cycle = (TIM2_CCR1*100)/(TIM2_CCR2) 单位
(This example shows how to set up the TIM, and use it to measure the frequency and duty cycle of an external input signal. TIM2 clock set to 72MHz and the prescaler is set to 0, TIM2 is counter clock can be expressed as: TIM2 is counter clock = TIMxCLK/(prescaler. Ppls1) = 72 MHz, the minimum measurable frequency value of 1100 Hz. Set TIM2 PWM input mode (PWM Input Mode), the external signal as an input connected to the the TIM2 Channel 2. TIM2 counter interrupt signal to measure frequency and duty cycle. Calculate the frequency and duty cycle of the signal in TIM2_IRQHandler as follows: variable " Frequency" on the grounds of the external signal frequency by the following formula: Frequency = TIM2 is counter clock/TIM2_CCR2 unit Hz variable Duty_Cycle " on the grounds of the following formula to get external duty cycle: Duty_Cycle = (TIM2_CCR1* 100)/(TIM2_CCR2) in )
- 2012-05-18 18:28:47下载
- 积分:1
-
EIH
About Control System
- 2009-06-06 21:14:29下载
- 积分:1
-
k-fold_cross-validation_binary_libsvm
K fold cross validation on svm
- 2016-10-30 00:53:07下载
- 积分:1
-
compare
This assignment aims at making the students familiar with the reactive (on-demand) routing protocols used in ad hoc networks and compare the performance of DSR and AODV protocols.
- 2012-08-25 00:02:56下载
- 积分:1
-
PID程序 - 副本
变结构PID仿真rar包,附加书籍资料PDF,[先进PID控制MATLAB仿真].刘金琨.高清文字版(Variable structure PID simulation rar package, additional book PDF, [Advanced PID control MATLAB simulation]. Liu Jinqi. HD text edition)
- 2020-11-03 19:29:52下载
- 积分:1
-
key
基于stm32vct6的4*4矩阵键盘扫描程序(4*4 keyboard program for stm32vct6)
- 2013-08-28 19:12:30下载
- 积分:1
-
PMSM
成熟伺服系统的速度观测和编码器自动调零程序(Speed observation of mature servo system and automatic zero setting program)
- 2016-12-03 20:25:10下载
- 积分:1
-
i-boot-lite
以px255处理器的开发板的bootloader 原代码(sourcecode of bootloader for px255 embedded board)
- 2013-01-01 17:34:49下载
- 积分:1
-
MPPTsollarpanel
基于AVR单片机的MPPT程序(爬山法),非常好用!(AVR microcontroller based MPPT program (hill climbing), very easy to use!)
- 2014-06-22 20:35:58下载
- 积分:1
-
各个程序集合压缩包
说明: 避障小车红外避障,超声波避障,寻光外加寻迹(Obstacle Avoidance Car Infrared Obstacle Avoidance, Ultrasound Obstacle Avoidance, Light Seeking and External Tracking)
- 2019-04-25 20:58:52下载
- 积分:1