-
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
-
AD594AD595cn
主要介绍了AD594AD595调理热电偶信号的应用,以及在应用当中的注意事项。(Introduces AD594AD595 thermocouple signal conditioning applications, as well as among the considerations in the application.)
- 2015-02-11 12:42:04下载
- 积分:1
-
AT24C256
AT24C256的初始化代码,已经完全经过调试,用C51驱动的(AT24C256 initialization code has been completely after debugging, using C51-driven)
- 2008-07-10 14:43:25下载
- 积分:1
-
SPI
stm32的SPI库函数固件库,挺好用的,新手必备!(SPI for STM32.And it is very useful.)
- 2020-06-19 06:40:02下载
- 积分:1
-
自适应PID
说明: 自适应PID,基于单神经的一种自适应PID控制算法(Adaptive PID, an adaptive PID control algorithm based on single nerve)
- 2019-03-04 09:29:06下载
- 积分:1
-
zhiliudianji
用单片机设计的直流电机控制,proteus仿真(DC motor control with a single-chip design, proteus simulation)
- 2013-04-27 08:51:19下载
- 积分:1
-
ATT7022B3
ATT7022的采集,校准,纯软件实现。适合与多功能电表的开发!(ATT7022 acquisition, calibration, pure software implementation. Suitable for development with multi-meter!)
- 2021-01-29 17:08:35下载
- 积分:1
-
ewarm-6.40.5-project-with-crc32-and-start-value
CRC32 source code for IAR workbench
- 2016-10-21 11:16:42下载
- 积分:1
-
avr16-1023-2
mage16,LCM1604驱动8线,调试成功(mage16, LCM1604 Line Driver 8, debugging success)
- 2006-10-23 19:03:42下载
- 积分:1
-
1602lcd
51单片机的数字显示代码,开发板上的例程,大家看看。(51 Singlechip figures show the code, development board routines, take a look at everyone.)
- 2008-06-06 16:55:32下载
- 积分:1