文件名称:Example1
介绍说明--下载内容来自于网络,使用问题请自行百度
本例展示了如何利用外设TIM2来产生四路频率不同的信号。
TIM2时钟设置为36MHz,预分频设置为2,使用输出比较-翻转模式(Output Compare Toggle Mode)。
TIM2计数器时钟可表达为:TIM2 counter clock = TIMxCLK / (Prescaler +1) = 12 MHz
设置TIM2_CCR1寄存器值为32768,则CC1更新频率为TIM2计数器时钟频率除以CCR1寄存器值,为366.2 Hz。因此,TIM2通道1可产生一个频率为183.1 Hz的周期信号。
同理,根据寄存器TIM2_CCR2 、TIM2_CCR3和 TIM2_CCR4的值,TIM2通道2可产生一个频率为366.3 Hz的周期信号;TIM2通道3可产生一个频率为732.4 Hz的周期信号;TIM2通道4可产生一个频率为1464.8 Hz的周期信号。
可以通过示波器观察各路输出-This example demonstrates how to use peripherals TIM2 to generate four different signal frequencies. TIM2 clock set to 36MHz, pre-divider is set to 2, the use of output compare- flip model (Output Compare Toggle Mode). TIM2 counter clock can be expressed as: TIM2 counter clock = TIMxCLK/(Prescaler+ 1) = 12 MHz set TIM2_CCR1 register value is 32768, then cC1 update frequency for TIM2 counter clock frequency divided by the value of CCR1 register for 366.2 Hz. Therefore, TIM2 channel 1 can generate a frequency of 183.1 Hz for the periodic signal. Similarly, under the register TIM2_CCR2, TIM2_CCR3 and TIM2_CCR4 value, TIM2 channel 2 can have a frequency of 366.3 Hz cycle signal TIM2 channel 3 can have a frequency of 732.4 Hz cycle signal TIM2 Channel 4 can produce a frequency of 1464.8 Hz cycle signal. Can be observed through the oscilloscope various output
TIM2时钟设置为36MHz,预分频设置为2,使用输出比较-翻转模式(Output Compare Toggle Mode)。
TIM2计数器时钟可表达为:TIM2 counter clock = TIMxCLK / (Prescaler +1) = 12 MHz
设置TIM2_CCR1寄存器值为32768,则CC1更新频率为TIM2计数器时钟频率除以CCR1寄存器值,为366.2 Hz。因此,TIM2通道1可产生一个频率为183.1 Hz的周期信号。
同理,根据寄存器TIM2_CCR2 、TIM2_CCR3和 TIM2_CCR4的值,TIM2通道2可产生一个频率为366.3 Hz的周期信号;TIM2通道3可产生一个频率为732.4 Hz的周期信号;TIM2通道4可产生一个频率为1464.8 Hz的周期信号。
可以通过示波器观察各路输出-This example demonstrates how to use peripherals TIM2 to generate four different signal frequencies. TIM2 clock set to 36MHz, pre-divider is set to 2, the use of output compare- flip model (Output Compare Toggle Mode). TIM2 counter clock can be expressed as: TIM2 counter clock = TIMxCLK/(Prescaler+ 1) = 12 MHz set TIM2_CCR1 register value is 32768, then cC1 update frequency for TIM2 counter clock frequency divided by the value of CCR1 register for 366.2 Hz. Therefore, TIM2 channel 1 can generate a frequency of 183.1 Hz for the periodic signal. Similarly, under the register TIM2_CCR2, TIM2_CCR3 and TIM2_CCR4 value, TIM2 channel 2 can have a frequency of 366.3 Hz cycle signal TIM2 channel 3 can have a frequency of 732.4 Hz cycle signal TIM2 Channel 4 can produce a frequency of 1464.8 Hz cycle signal. Can be observed through the oscilloscope various output
相关搜索: TIM2_CCR1
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Example1/main.c
Example1/readme.txt
Example1/stm32f10x_conf.h
Example1/stm32f10x_it.h
Example1/settings/TIM_TEXT1.cspy.bat
Example1/settings/TIM_TEXT1.dbgdt
Example1/settings/TIM_TEXT1.dni
Example1/settings/TIM_TEXT1.wsdt
Example1/cortexm3_macro.h
Example1/stm32f10x_adc.h
Example1/stm32f10x_bkp.h
Example1/stm32f10x_can.h
Example1/stm32f10x_dma.h
Example1/stm32f10x_exti.h
Example1/stm32f10x_flash.h
Example1/stm32f10x_gpio.h
Example1/stm32f10x_i2c.h
Example1/stm32f10x_iwdg.h
Example1/stm32f10x_lib.h
Example1/stm32f10x_map.h
Example1/stm32f10x_nvic.h
Example1/stm32f10x_pwr.h
Example1/stm32f10x_rcc.h
Example1/stm32f10x_rtc.h
Example1/stm32f10x_spi.h
Example1/stm32f10x_systick.h
Example1/stm32f10x_tim1.h
Example1/stm32f10x_tim.h
Example1/stm32f10x_type.h
Example1/stm32f10x_usart.h
Example1/stm32f10x_wwdg.h
Example1/stm32f10x_adc.c
Example1/stm32f10x_bkp.c
Example1/stm32f10x_can.c
Example1/stm32f10x_dma.c
Example1/stm32f10x_exti.c
Example1/stm32f10x_flash.c
Example1/stm32f10x_gpio.c
Example1/stm32f10x_i2c.c
Example1/stm32f10x_iwdg.c
Example1/stm32f10x_lib.c
Example1/stm32f10x_nvic.c
Example1/stm32f10x_pwr.c
Example1/stm32f10x_rcc.c
Example1/stm32f10x_rtc.c
Example1/stm32f10x_spi.c
Example1/stm32f10x_systick.c
Example1/stm32f10x_tim1.c
Example1/stm32f10x_tim.c
Example1/stm32f10x_usart.c
Example1/stm32f10x_wwdg.c
Example1/TIM_TEXT1.eww
Example1/TIM_TEXT1.ewd
Example1/TIM_TEXT1.dep
Example1/stm32f10x_it.c
Example1/settings
Example1/Debug
Example1
Example1/readme.txt
Example1/stm32f10x_conf.h
Example1/stm32f10x_it.h
Example1/settings/TIM_TEXT1.cspy.bat
Example1/settings/TIM_TEXT1.dbgdt
Example1/settings/TIM_TEXT1.dni
Example1/settings/TIM_TEXT1.wsdt
Example1/cortexm3_macro.h
Example1/stm32f10x_adc.h
Example1/stm32f10x_bkp.h
Example1/stm32f10x_can.h
Example1/stm32f10x_dma.h
Example1/stm32f10x_exti.h
Example1/stm32f10x_flash.h
Example1/stm32f10x_gpio.h
Example1/stm32f10x_i2c.h
Example1/stm32f10x_iwdg.h
Example1/stm32f10x_lib.h
Example1/stm32f10x_map.h
Example1/stm32f10x_nvic.h
Example1/stm32f10x_pwr.h
Example1/stm32f10x_rcc.h
Example1/stm32f10x_rtc.h
Example1/stm32f10x_spi.h
Example1/stm32f10x_systick.h
Example1/stm32f10x_tim1.h
Example1/stm32f10x_tim.h
Example1/stm32f10x_type.h
Example1/stm32f10x_usart.h
Example1/stm32f10x_wwdg.h
Example1/stm32f10x_adc.c
Example1/stm32f10x_bkp.c
Example1/stm32f10x_can.c
Example1/stm32f10x_dma.c
Example1/stm32f10x_exti.c
Example1/stm32f10x_flash.c
Example1/stm32f10x_gpio.c
Example1/stm32f10x_i2c.c
Example1/stm32f10x_iwdg.c
Example1/stm32f10x_lib.c
Example1/stm32f10x_nvic.c
Example1/stm32f10x_pwr.c
Example1/stm32f10x_rcc.c
Example1/stm32f10x_rtc.c
Example1/stm32f10x_spi.c
Example1/stm32f10x_systick.c
Example1/stm32f10x_tim1.c
Example1/stm32f10x_tim.c
Example1/stm32f10x_usart.c
Example1/stm32f10x_wwdg.c
Example1/TIM_TEXT1.eww
Example1/TIM_TEXT1.ewd
Example1/TIM_TEXT1.dep
Example1/stm32f10x_it.c
Example1/settings
Example1/Debug
Example1
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.