|------------------------------------------------------------
|注:该例程裁剪于官方例程,已经在野火M3工程模板中编译成功, |
|不提供具体的技术支持,有问题的到论坛发帖讨论。 |
| |
|野火M3技术讨论区:http://www.ourdev.cn/forum-1008-1.html |
| |
| WildFire Team 2012 于广州 |
--------------------------------------------------------------
以下是该例程的官方描述(为方便理解,fire已修改过)
--------------------------------------------------------------
/**
@page TIM_PWM_Input TIM_PWM_Input
@verbatim
******************** (C) COPYRIGHT 2009 STMicroelectronics *******************
* @file TIM/PWM_Input/readme.txt
* @author MCD Application Team
* @version V3.0.0
* @date 04/06/2009
* @brief Description of the TIM PWM_Input example.
******************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
******************************************************************************
@endverbatim
@par Example Description
This example shows how to use the TIM peripheral to measure the frequency and
duty cycle of an external signal.
The TIMxCLK frequency is set to 72 MHz, the Prescaler is 0 so the TIM2 counter
clock is 72 MHz. so the minimum frequency value to measure is 1100 Hz.
TIM2 is configured in PWM Input Mode: the external signal is connected to
TIM2 Channel2 used as input pin.
To measure the frequency and the duty cycle we use the TIM2 CC2 interrupt request,
so In the TIM2_IRQHandler routine, the frequency and the duty cycle of the external
signal are computed.
The "Frequency" variable contains the external signal frequency:
Frequency = TIM2 counter clock / TIM2_CCR2 in Hz,
The "DutyCycle" variable contains the external signal duty cycle:
DutyCycle = (TIM2_CCR1*100)/(TIM2_CCR2) in %.
@par Directory contents
- TIM/PWM_Input/stm32f10x_conf.h Library Configuration file
- TIM/PWM_Input/stm32f10x_it.c Interrupt handlers
- TIM/PWM_Input/stm32f10x_it.h Interrupt handlers header file
- TIM/PWM_Input/main.c Main program
- Connect the external signal to measure to the TIM2 CH2 pin (PA.01).
- 将外部的需要测量的信号连接到TIM2 CH2 pin (PA.01)即可测量,野火M3开
- 发板中已经留有 PA.01 的端子接口,可方便用户连接外部信号。
@par How to use it ?
In order to make the program work, you must do the following:
- Create a project and setup all project configuration
- Add the required Library files:
- stm32f10x_gpio.c
- stm32f10x_rcc.c
- stm32f10x_tim.c
- misc.c
- system_stm32f10x.c
@note
- Low-density devices are STM32F101xx and STM32F103xx microcontrollers where
the Flash memory density ranges between 16 and 32 Kbytes.
- Medium-density devices are STM32F101xx and STM32F103xx microcontrollers where
the Flash memory density ranges between 32 and 128 Kbytes.
- High-density devices are STM32F101xx and STM32F103xx microcontrollers where
the Flash memory density ranges between 256 and 512 Kbytes.
* <h3><center>© COPYRIGHT 2009 STMicroelectronics</center></h3>
*/
没有合适的资源?快使用搜索试试~ 我知道了~
PWM-Input-Capture.rar_Capture_Input capture_PWM采集_stm32 input _获
共122个文件
h:30个
c:29个
d:13个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 170 浏览量
2022-09-19
22:21:35
上传
评论 1
收藏 1.31MB RAR 举报
温馨提示
stm32单脉冲输入捕获,获取PWM的频率与占空比,可用于采集电机速度。
资源推荐
资源详情
资源评论
收起资源包目录
PWM-Input-Capture.rar_Capture_Input capture_PWM采集_stm32 input _获 (122个子文件)
stm32f10x_it.__i 309B
pwm_output.__i 301B
usart1.__i 285B
main.__i 277B
STM32-DEMO.axf 325KB
STM32-DEMO_uvopt.bak 80KB
STM32-DEMO_uvproj.bak 16KB
stm32f10x_tim.c 100KB
stm32f10x_adc.c 46KB
stm32f10x_i2c.c 36KB
stm32f10x_fsmc.c 34KB
stm32f10x_usart.c 34KB
stm32f10x_rcc.c 33KB
stm32f10x_can.c 30KB
stm32f10x_sdio.c 28KB
stm32f10x_spi.c 27KB
stm32f10x_dma.c 27KB
stm32f10x_flash.c 26KB
system_stm32f10x.c 24KB
stm32f10x_gpio.c 17KB
core_cm3.c 16KB
stm32f10x_dac.c 13KB
stm32f10x_pwr.c 9KB
stm32f10x_rtc.c 8KB
stm32f10x_bkp.c 8KB
misc.c 7KB
stm32f10x_exti.c 7KB
stm32f10x_wwdg.c 5KB
stm32f10x_it.c 5KB
pwm_output.c 5KB
stm32f10x_iwdg.c 5KB
stm32f10x_dbgmcu.c 4KB
main.c 4KB
stm32f10x_crc.c 3KB
usart1.c 3KB
led.c 952B
stm32f10x_tim.crf 262KB
stm32f10x_rcc.crf 249KB
stm32f10x_usart.crf 247KB
stm32f10x_it.crf 246KB
main.crf 246KB
usart1.crf 246KB
stm32f10x_gpio.crf 245KB
system_stm32f10x.crf 243KB
pwm_output.crf 242KB
misc.crf 242KB
led.crf 213KB
core_cm3.crf 3KB
stm32f10x_it.d 757B
stm32f10x_usart.d 736B
stm32f10x_gpio.d 721B
stm32f10x_tim.d 706B
stm32f10x_rcc.d 706B
system_stm32f10x.d 684B
pwm_output.d 635B
main.d 627B
usart1.d 625B
misc.d 571B
led.d 396B
core_cm3.d 96B
startup_stm32f10x_hd.d 75B
STM32-DEMO_Temlate-DEMO.dep 8KB
STM32-DEMO_LED-DEMO.dep 4KB
stm32f10x.h 518KB
stm32f10x_tim.h 48KB
core_cm3.h 41KB
stm32f10x_adc.h 19KB
stm32f10x_dma.h 18KB
stm32f10x_sdio.h 18KB
stm32f10x_fsmc.h 17KB
stm32f10x_i2c.h 17KB
stm32f10x_rcc.h 16KB
stm32f10x_gpio.h 15KB
stm32f10x_spi.h 15KB
stm32f10x_usart.h 14KB
stm32f10x_flash.h 14KB
stm32f10x_can.h 14KB
stm32f10x_dac.h 10KB
stm32f10x_bkp.h 7KB
stm32f10x_exti.h 6KB
misc.h 5KB
stm32f10x_pwr.h 4KB
stm32f10x_iwdg.h 4KB
stm32f10x_rtc.h 4KB
stm32f10x_conf.h 3KB
stm32f10x_dbgmcu.h 3KB
stm32f10x_wwdg.h 3KB
system_stm32f10x.h 2KB
stm32f10x_crc.h 2KB
stm32f10x_it.h 2KB
led.h 560B
usart1.h 203B
pwm_output.h 136B
STM32-DEMO.hex 22KB
STM32-DEMO.htm 64KB
JLinkSettings.ini 285B
STM32-DEMO.lnp 671B
startup_stm32f10x_hd.lst 52KB
STM32-DEMO.map 70KB
stm32f10x_tim.o 298KB
共 122 条
- 1
- 2
资源评论
钱亚锋
- 粉丝: 89
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功