文件名称: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
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
(系统自动生成,下载前可以参看下载内容)
下载文件列表
example6_TIM/App/bsp.c
example6_TIM/App/bsp.h
example6_TIM/App/main.c
example6_TIM/App/stm32f10x_conf.h
example6_TIM/App/stm32f10x_it.c
example6_TIM/App/stm32f10x_it.h
example6_TIM/FWLib/inc/cortexm3_macro.h
example6_TIM/FWLib/inc/stm32f10x_adc.h
example6_TIM/FWLib/inc/stm32f10x_bkp.h
example6_TIM/FWLib/inc/stm32f10x_can.h
example6_TIM/FWLib/inc/stm32f10x_dma.h
example6_TIM/FWLib/inc/stm32f10x_exti.h
example6_TIM/FWLib/inc/stm32f10x_flash.h
example6_TIM/FWLib/inc/stm32f10x_gpio.h
example6_TIM/FWLib/inc/stm32f10x_i2c.h
example6_TIM/FWLib/inc/stm32f10x_iwdg.h
example6_TIM/FWLib/inc/stm32f10x_lib.h
example6_TIM/FWLib/inc/stm32f10x_map.h
example6_TIM/FWLib/inc/stm32f10x_nvic.h
example6_TIM/FWLib/inc/stm32f10x_pwr.h
example6_TIM/FWLib/inc/stm32f10x_rcc.h
example6_TIM/FWLib/inc/stm32f10x_rtc.h
example6_TIM/FWLib/inc/stm32f10x_spi.h
example6_TIM/FWLib/inc/stm32f10x_systick.h
example6_TIM/FWLib/inc/stm32f10x_tim.h
example6_TIM/FWLib/inc/stm32f10x_tim1.h
example6_TIM/FWLib/inc/stm32f10x_type.h
example6_TIM/FWLib/inc/stm32f10x_usart.h
example6_TIM/FWLib/inc/stm32f10x_wwdg.h
example6_TIM/FWLib/src/stm32f10x_adc.c
example6_TIM/FWLib/src/stm32f10x_bkp.c
example6_TIM/FWLib/src/stm32f10x_can.c
example6_TIM/FWLib/src/stm32f10x_dma.c
example6_TIM/FWLib/src/stm32f10x_exti.c
example6_TIM/FWLib/src/stm32f10x_flash.c
example6_TIM/FWLib/src/stm32f10x_gpio.c
example6_TIM/FWLib/src/stm32f10x_i2c.c
example6_TIM/FWLib/src/stm32f10x_iwdg.c
example6_TIM/FWLib/src/stm32f10x_lib.c
example6_TIM/FWLib/src/stm32f10x_nvic.c
example6_TIM/FWLib/src/stm32f10x_pwr.c
example6_TIM/FWLib/src/stm32f10x_rcc.c
example6_TIM/FWLib/src/stm32f10x_rtc.c
example6_TIM/FWLib/src/stm32f10x_spi.c
example6_TIM/FWLib/src/stm32f10x_systick.c
example6_TIM/FWLib/src/stm32f10x_tim.c
example6_TIM/FWLib/src/stm32f10x_tim1.c
example6_TIM/FWLib/src/stm32f10x_usart.c
example6_TIM/FWLib/src/stm32f10x_wwdg.c
example6_TIM/project/cortexm3_macro.s
example6_TIM/project/Debug/Exe/example6_TIM.out
example6_TIM/project/Debug/Obj/bsp.o
example6_TIM/project/Debug/Obj/cortexm3_macro.o
example6_TIM/project/Debug/Obj/example6_TIM.pbd
example6_TIM/project/Debug/Obj/main.o
example6_TIM/project/Debug/Obj/stm32f10x_flash.o
example6_TIM/project/Debug/Obj/stm32f10x_gpio.o
example6_TIM/project/Debug/Obj/stm32f10x_it.o
example6_TIM/project/Debug/Obj/stm32f10x_lib.o
example6_TIM/project/Debug/Obj/stm32f10x_nvic.o
example6_TIM/project/Debug/Obj/stm32f10x_rcc.o
example6_TIM/project/Debug/Obj/stm32f10x_tim.o
example6_TIM/project/Debug/Obj/stm32f10x_vector.o
example6_TIM/project/example6_TIM.dep
example6_TIM/project/example6_TIM.ewd
example6_TIM/project/example6_TIM.ewp
example6_TIM/project/example6_TIM.eww
example6_TIM/project/lnkarm_flash.xcl
example6_TIM/project/lnkarm_ram.xcl
example6_TIM/project/settings/example6_TIM.cspy.bat
example6_TIM/project/settings/example6_TIM.dbgdt
example6_TIM/project/settings/example6_TIM.dni
example6_TIM/project/settings/example6_TIM.wsdt
example6_TIM/project/settings/example6_TIM_Debug.jlink
example6_TIM/project/stm32f10x_flash.icf
example6_TIM/project/stm32f10x_ram.icf
example6_TIM/project/stm32f10x_vector.c
example6_TIM/project/Debug/Exe
example6_TIM/project/Debug/List
example6_TIM/project/Debug/Obj
example6_TIM/FWLib/inc
example6_TIM/FWLib/src
example6_TIM/project/Debug
example6_TIM/project/settings
example6_TIM/App
example6_TIM/FWLib
example6_TIM/project
example6_TIM
example6_TIM/App/bsp.h
example6_TIM/App/main.c
example6_TIM/App/stm32f10x_conf.h
example6_TIM/App/stm32f10x_it.c
example6_TIM/App/stm32f10x_it.h
example6_TIM/FWLib/inc/cortexm3_macro.h
example6_TIM/FWLib/inc/stm32f10x_adc.h
example6_TIM/FWLib/inc/stm32f10x_bkp.h
example6_TIM/FWLib/inc/stm32f10x_can.h
example6_TIM/FWLib/inc/stm32f10x_dma.h
example6_TIM/FWLib/inc/stm32f10x_exti.h
example6_TIM/FWLib/inc/stm32f10x_flash.h
example6_TIM/FWLib/inc/stm32f10x_gpio.h
example6_TIM/FWLib/inc/stm32f10x_i2c.h
example6_TIM/FWLib/inc/stm32f10x_iwdg.h
example6_TIM/FWLib/inc/stm32f10x_lib.h
example6_TIM/FWLib/inc/stm32f10x_map.h
example6_TIM/FWLib/inc/stm32f10x_nvic.h
example6_TIM/FWLib/inc/stm32f10x_pwr.h
example6_TIM/FWLib/inc/stm32f10x_rcc.h
example6_TIM/FWLib/inc/stm32f10x_rtc.h
example6_TIM/FWLib/inc/stm32f10x_spi.h
example6_TIM/FWLib/inc/stm32f10x_systick.h
example6_TIM/FWLib/inc/stm32f10x_tim.h
example6_TIM/FWLib/inc/stm32f10x_tim1.h
example6_TIM/FWLib/inc/stm32f10x_type.h
example6_TIM/FWLib/inc/stm32f10x_usart.h
example6_TIM/FWLib/inc/stm32f10x_wwdg.h
example6_TIM/FWLib/src/stm32f10x_adc.c
example6_TIM/FWLib/src/stm32f10x_bkp.c
example6_TIM/FWLib/src/stm32f10x_can.c
example6_TIM/FWLib/src/stm32f10x_dma.c
example6_TIM/FWLib/src/stm32f10x_exti.c
example6_TIM/FWLib/src/stm32f10x_flash.c
example6_TIM/FWLib/src/stm32f10x_gpio.c
example6_TIM/FWLib/src/stm32f10x_i2c.c
example6_TIM/FWLib/src/stm32f10x_iwdg.c
example6_TIM/FWLib/src/stm32f10x_lib.c
example6_TIM/FWLib/src/stm32f10x_nvic.c
example6_TIM/FWLib/src/stm32f10x_pwr.c
example6_TIM/FWLib/src/stm32f10x_rcc.c
example6_TIM/FWLib/src/stm32f10x_rtc.c
example6_TIM/FWLib/src/stm32f10x_spi.c
example6_TIM/FWLib/src/stm32f10x_systick.c
example6_TIM/FWLib/src/stm32f10x_tim.c
example6_TIM/FWLib/src/stm32f10x_tim1.c
example6_TIM/FWLib/src/stm32f10x_usart.c
example6_TIM/FWLib/src/stm32f10x_wwdg.c
example6_TIM/project/cortexm3_macro.s
example6_TIM/project/Debug/Exe/example6_TIM.out
example6_TIM/project/Debug/Obj/bsp.o
example6_TIM/project/Debug/Obj/cortexm3_macro.o
example6_TIM/project/Debug/Obj/example6_TIM.pbd
example6_TIM/project/Debug/Obj/main.o
example6_TIM/project/Debug/Obj/stm32f10x_flash.o
example6_TIM/project/Debug/Obj/stm32f10x_gpio.o
example6_TIM/project/Debug/Obj/stm32f10x_it.o
example6_TIM/project/Debug/Obj/stm32f10x_lib.o
example6_TIM/project/Debug/Obj/stm32f10x_nvic.o
example6_TIM/project/Debug/Obj/stm32f10x_rcc.o
example6_TIM/project/Debug/Obj/stm32f10x_tim.o
example6_TIM/project/Debug/Obj/stm32f10x_vector.o
example6_TIM/project/example6_TIM.dep
example6_TIM/project/example6_TIM.ewd
example6_TIM/project/example6_TIM.ewp
example6_TIM/project/example6_TIM.eww
example6_TIM/project/lnkarm_flash.xcl
example6_TIM/project/lnkarm_ram.xcl
example6_TIM/project/settings/example6_TIM.cspy.bat
example6_TIM/project/settings/example6_TIM.dbgdt
example6_TIM/project/settings/example6_TIM.dni
example6_TIM/project/settings/example6_TIM.wsdt
example6_TIM/project/settings/example6_TIM_Debug.jlink
example6_TIM/project/stm32f10x_flash.icf
example6_TIM/project/stm32f10x_ram.icf
example6_TIM/project/stm32f10x_vector.c
example6_TIM/project/Debug/Exe
example6_TIM/project/Debug/List
example6_TIM/project/Debug/Obj
example6_TIM/FWLib/inc
example6_TIM/FWLib/src
example6_TIM/project/Debug
example6_TIM/project/settings
example6_TIM/App
example6_TIM/FWLib
example6_TIM/project
example6_TIM
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.