TIM1_6Steps

所属分类:系统设计方案
开发工具:C/C++
文件大小:8KB
下载次数:0
上传日期:2019-04-22 10:33:11
上 传 者akiphm
说明:  STM8L RTC UPLOAD AND MORE

文件列表:
TIM1_6Steps\main.c (7947, 2014-10-22)
TIM1_6Steps\stm8l15x_conf.h (3434, 2014-10-22)
TIM1_6Steps\stm8l15x_it.c (15686, 2014-10-22)
TIM1_6Steps\stm8l15x_it.h (4128, 2014-10-22)
TIM1_6Steps (0, 2019-04-18)

/** @page TIM1_6Steps Six steps PWM signal generation using TIM1 @verbatim ******************** (C) COPYRIGHT 2013 STMicroelectronics ******************* * @file TIM1/TIM1_6Steps/readme.txt * @author MCD Application Team * @version V1.5.2 * @date 30-September-2014 * @brief Description of the TIM1 6 steps Example. ****************************************************************************** * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** @endverbatim @par Example description This example shows how to configure the TIM1 peripheral to generate 6 steps PWM which are used for motor control. The 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 180.2 ms: using the TIM4 Update interrupt. The TIM1 is configured in Timing Mode, each time a COM event occurs, a new TIM1 configuration will be set in advance. The following Table describes the TIM1 Channels states: @code *********************************************** | Step1 | Step2 | Step3 | Step4 | Step5 | Step6| ********************************************************** |Channel1 | PWM | 0 | 0 | 0 | 0 | PWM | ********************************************************** |Channel1N | 0 | 0 | PWM | PWM | 0 | 0 | ********************************************************** |Channel2 | 0 | 0 | 0 | PWM | PWM | 0 | ********************************************************** |Channel2N | PWM | PWM | 0 | 0 | 0 | 0 | ********************************************************** |Channel3 | 0 | PWM | PWM | 0 | 0 | 0 | ********************************************************** |Channel3N | 0 | 0 | 0 | 0 | PWM | PWM | ********************************************************** @endcode The TIM1 waveform can be displayed using an oscilloscope. @par Directory contents - TIM1/TIM1_6Steps/main.c Main file containing the "main" function - TIM1/TIM1_6Steps/stm8l15x_conf.h Library Configuration file - TIM1/TIM1_6Steps/stm8l15x_it.c Interrupt routines source - TIM1/TIM1_6Steps/stm8l15x_it.h Interrupt routines declaration @par Hardware and Software environment - This example runs on STM8L15x High-Density, Medium-Density Plus and Medium-Density Devices. - This example has been tested with STMicroelectronics STM8L1528-EVAL (STM8L15x High-Density devices) and STM8L1526-EVAL (STM8L15x Medium-Density devices) evaluation boards and can be easily tailored to any other development board. - STM8L1528-EVAL and STM8L1526-EVAL Set-up - Make sure that the LCD glass daughter board is mounted in IO position. For more details please refer to the evaluation board user manual. - Connect TIM1 channels pins to an oscilloscope as follows: - TIM1 Channel 1 pin (PD2) - TIM1 Channel 1N pin (PD7) - TIM1 Channel 2 pin (PD4) - TIM1 Channel 2N pin (PE1) - TIM1 Channel 3 pin (PD5) - TIM1 Channel 3N pin (PE2) @par How to use it ? In order to make the program work, you must do the following : - Copy all source files from this example folder to the template folder under Project\STM8L15x_StdPeriph_Template - Open your preferred toolchain - Rebuild all files and load your image into target memory - Run the example - Connect the TIM1 channels pins to an oscilloscope *

© COPYRIGHT STMicroelectronics

*/

近期下载者

相关文件


收藏者