6Steps

所属分类:其他嵌入式/单片机内容
开发工具:C/C++
文件大小:9KB
下载次数:69
上传日期:2010-03-11 13:44:27
上 传 者kaibest
说明:   配置TIM1外设来产生六步PWM信号
(This example shows how to configure the TIM1 peripheral to generate 6 Steps.)

文件列表:
6Steps\main.c (11617, 2008-09-23)
6Steps\stm32f10x_conf.h (6307, 2008-09-23)
6Steps\stm32f10x_it.c (33413, 2008-09-23)
6Steps\stm32f10x_it.h (3842, 2008-09-23)
6Steps (0, 2010-03-11)

/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** * File Name : readme.txt * Author : MCD Application Team * Version : V2.0.1 * Date : 06/13/2008 * Description : Description of the TIM 6Steps 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. *******************************************************************************/ Example description =================== This example shows how to configure the TIM1 peripheral to generate 6 Steps. The STM32F10x TIM1 peripheral offers the possibility to program in advance the configuration for the next TIM1 outputs behaviour (step) and change the configuration of all the channels at the same time. This operation is possible when the COM (commutation) event is used. The COM event can be generated by software by setting the COM bit in the TIM1_EGR register or by hardware (on TRC rising edge). In this example, a software COM event is generated each 100 ms: using the SysTick interrupt. The TIM1 is configured in Timing Mode, each time a COM event occurs, a new TIM1 configuration will be set in advance. The break Polarity is used at High level. The following Table describes the TIM1 Channels states: ----------------------------------------------- | Step1 | Step2 | Step3 | Step4 | Step5 | Step6 | ---------------------------------------------------------- |Channel1 | 1 | 0 | 0 | 0 | 0 | 1 | ---------------------------------------------------------- |Channel1N | 0 | 0 | 1 | 1 | 0 | 0 | ---------------------------------------------------------- |Channel2 | 0 | 0 | 0 | 1 | 1 | 0 | ---------------------------------------------------------- |Channel2N | 1 | 1 | 0 | 0 | 0 | 0 | ---------------------------------------------------------- |Channel3 | 0 | 1 | 1 | 0 | 0 | 0 | ---------------------------------------------------------- |Channel3N | 0 | 0 | 0 | 0 | 1 | 1 | ---------------------------------------------------------- Directory contents ================== stm32f10x_conf.h Library Configuration file stm32f10x_it.c Interrupt handlers stm32f10x_it.h Interrupt handlers header file main.c Main program Hardware environment ==================== This example runs on STMicroelectronics STM3210B-EVAL and STM3210E-EVAL evaluation boards and can be easily tailored to any other hardware. There is no need for any modification when switching between these two boards. - Connect the TIM1 pins to an oscilloscope to monitor the different waveforms: - TIM1_CH3 pin (PA.10) - TIM1_CH1N pin (PB.13) - TIM1_CH2 pin (PA.09) - TIM1_CH3N pin (PB.15) - TIM1_CH1 pin (PA.08) - TIM1_CH2N pin (PB.14) - Connect the TIM1 break pin TIM1_BKIN pin (PB.12) to the GND. To generate a break event, switch this pin level from 0V to 3.3V. How to use it ============= In order to make the program work, you must do the following: - Create a project and setup all your toolchain's start-up files - Compile the directory content files and required Library files: + stm32f10x_lib.c + stm32f10x_tim.c + stm32f10x_gpio.c + stm32f10x_rcc.c + stm32f10x_nvic.c + stm32f10x_flash.c + stm32f10x_systick.c - Link all compiled files and load your image into target memory - Run the example ******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE******

近期下载者

相关文件


收藏者