STM32F4_TIM_PWM_Output

所属分类:处理器开发
开发工具:C/C++
文件大小:39KB
下载次数:68
上传日期:2012-08-12 00:17:45
上 传 者MOXUQIN
说明:  STM32F407 脉冲宽度输出调试程序,固件包程序例程,有完整的c语言源代码
(The STM32F407 pulse width output debugger, the firmware package routine, a complete C language source code)

文件列表:
TIM_PWM_Output\EWARM\stm32f4xx_flash.icf (1342, 2011-10-28)
TIM_PWM_Output\EWARM\TIM_PWM_Output.ewd (24222, 2011-10-28)
TIM_PWM_Output\EWARM\TIM_PWM_Output.ewp (26124, 2011-10-28)
TIM_PWM_Output\EWARM\TIM_PWM_Output.eww (168, 2011-10-28)
TIM_PWM_Output\main.c (7703, 2011-10-28)
TIM_PWM_Output\MDK-ARM\TIM_PWM_Output.uvopt (13333, 2011-10-28)
TIM_PWM_Output\MDK-ARM\TIM_PWM_Output.uvproj (17805, 2011-10-28)
TIM_PWM_Output\stm32f4xx_conf.h (3819, 2011-10-28)
TIM_PWM_Output\stm32f4xx_it.c (4446, 2011-10-28)
TIM_PWM_Output\stm32f4xx_it.h (1989, 2011-10-28)
TIM_PWM_Output\system_stm32f4xx.c (21172, 2011-10-28)
TIM_PWM_Output\TASKING\TIM_PWM_Output\.cproject (37887, 2011-10-28)
TIM_PWM_Output\TASKING\TIM_PWM_Output\.project (3096, 2011-10-28)
TIM_PWM_Output\TASKING\TIM_PWM_Output\TASKING\stm32f4xx.lsl (15846, 2011-10-28)
TIM_PWM_Output\TASKING\TIM_PWM_Output\TIM_PWM_Output.launch (4147, 2011-10-28)
TIM_PWM_Output\TrueSTUDIO\TIM_PWM_Output\.cproject (20653, 2011-10-28)
TIM_PWM_Output\TrueSTUDIO\TIM_PWM_Output\.project (4559, 2011-10-28)
TIM_PWM_Output\TrueSTUDIO\TIM_PWM_Output\.settings\com.atollic.truestudio.debug.hardware_device.prefs (222, 2011-10-28)
TIM_PWM_Output\TrueSTUDIO\TIM_PWM_Output\stm32_flash.ld (4978, 2011-10-28)
TIM_PWM_Output\TrueSTUDIO\TIM_PWM_Output\TIM_PWM_Output.elf.launch (4782, 2011-10-28)
TIM_PWM_Output\TASKING\.metadata\Link (0, 2011-10-28)
TIM_PWM_Output\TASKING\TIM_PWM_Output\TASKING (0, 2012-07-14)
TIM_PWM_Output\TrueSTUDIO\.metadata\Link (0, 2011-10-28)
TIM_PWM_Output\TrueSTUDIO\TIM_PWM_Output\.settings (0, 2012-07-14)
TIM_PWM_Output\TASKING\.metadata (0, 2012-07-14)
TIM_PWM_Output\TASKING\TIM_PWM_Output (0, 2012-07-14)
TIM_PWM_Output\TrueSTUDIO\.metadata (0, 2012-07-14)
TIM_PWM_Output\TrueSTUDIO\TIM_PWM_Output (0, 2012-07-14)
TIM_PWM_Output\EWARM (0, 2012-07-14)
TIM_PWM_Output\MDK-ARM (0, 2012-07-14)
TIM_PWM_Output\TASKING (0, 2012-07-14)
TIM_PWM_Output\TrueSTUDIO (0, 2012-07-14)
TIM_PWM_Output (0, 2012-07-14)

/** @page TIM_PWM_Output TIM_PWM_Output @verbatim ******************** (C) COPYRIGHT 2011 STMicroelectronics ******************* * @file TIM_PWM_Output/readme.txt * @author MCD Application Team * @version V1.0.0 * @date 19-September-2011 * @brief Description of the TIM PWM_Output 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 configure the TIM peripheral in PWM (Pulse Width Modulation) mode. The TIM3CLK frequency is set to SystemCoreClock / 2 (Hz), to get TIM3 counter clock at 28 MHz the Prescaler is computed as following: - Prescaler = (TIM3CLK / TIM3 counter clock) - 1 SystemCoreClock is set to 168 MHz for STM32F4xx Devices Revision A. The TIM3 is running at 42 KHz: TIM3 Frequency = TIM3 counter clock/(ARR + 1) = 28 MHz / 666 = 42 KHz The TIM3 CCR1 register value is equal to 333, so the TIM3 Channel 1 generates a PWM signal with a frequency equal to 30 KHz and a duty cycle equal to 50%: TIM3 Channel1 duty cycle = (TIM3_CCR1/ TIM3_ARR + 1)* 100 = 50% The TIM3 CCR2 register value is equal to 249, so the TIM3 Channel 2 generates a PWM signal with a frequency equal to 30 KHz and a duty cycle equal to 37.5%: TIM3 Channel2 duty cycle = (TIM3_CCR2/ TIM3_ARR + 1)* 100 = 37.5% The TIM3 CCR3 register value is equal to 166, so the TIM3 Channel 3 generates a PWM signal with a frequency equal to 30 KHz and a duty cycle equal to 25%: TIM3 Channel3 duty cycle = (TIM3_CCR3/ TIM3_ARR + 1)* 100 = 25% The TIM3 CCR4 register value is equal to 83, so the TIM3 Channel 4 generates a PWM signal with a frequency equal to 30 KHz and a duty cycle equal to 12.5%: TIM3 Channel4 duty cycle = (TIM3_CCR4/ TIM3_ARR + 1)* 100 = 12.5% The PWM waveform can be displayed using an oscilloscope. @par Directory contents - TIM_PWM_Output/stm32f4xx_conf.h Library Configuration file - TIM_PWM_Output/stm32f4xx_it.c Interrupt handlers - TIM_PWM_Output/stm32f4xx_it.h Interrupt handlers header file - TIM_PWM_Output/main.c Main program - TIM_PWM_Output/system_stm32f4xx.c STM32F4xx system clock configuration file @par Hardware and Software environment - This example runs on STM32F4xx Devices Revision A. - This example has been tested with STM32F4-Discovery (MB997) RevA and can be easily tailored to any other development board. - STM32F4-Discovery - Connect the following pins to an oscilloscope to monitor the different waveforms: - PC.06: (TIM3_CH1) - PC.07: (TIM3_CH2) - PB.00: (TIM3_CH3) - PB.01: (TIM3_CH4) @par How to use it ? In order to make the program work, you must do the following : + EWARM - Open the TIM_PWM_Output.eww workspace - Rebuild all files: Project->Rebuild all - Load project image: Project->Debug - Run program: Debug->Go(F5) + MDK-ARM - Open the TIM_PWM_Output.uvproj project - Rebuild all files: Project->Rebuild all target files - Load project image: Debug->Start/Stop Debug Session - Run program: Debug->Run (F5) + TASKING - Open TASKING toolchain. - Click on File->Import, select General->'Existing Projects into Workspace' and then click "Next". - Browse to TASKING workspace directory and select the project "TIM_PWM_Output" - Rebuild all project files: Select the project in the "Project explorer" window then click on Project->build project menu. - Run program: Select the project in the "Project explorer" window then click Run->Debug (F11) + TrueSTUDIO - Open the TrueSTUDIO toolchain. - Click on File->Switch Workspace->Other and browse to TrueSTUDIO workspace directory. - Click on File->Import, select General->'Existing Projects into Workspace' and then click "Next". - Browse to the TrueSTUDIO workspace directory and select the project "TIM_PWM_Output" - Rebuild all project files: Select the project in the "Project explorer" window then click on Project->build project menu. - Run program: Select the project in the "Project explorer" window then click Run->Debug (F11) *

© COPYRIGHT 2011 STMicroelectronics

*/

近期下载者

相关文件


收藏者