| 数据搜索系统,热门电子元器件搜索 |
|
STPS1L60 数据表(PDF) 17 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
STPS1L60 数据表(HTML) 17 Page - STMicroelectronics |
|
17 / 34 page ![]() AN3151 Firmware implementation Doc ID 17051 Rev 1 17/34 5 Firmware implementation Below are some details of firmware implementation. It's not an exhaustive firmware implementation description but it mainly focuses on some important microcontroller settings: TIM1, ADC and PI controller implementation. The firmware developed for the LED Streetlight application is based on STM8S firmware library release 1.1 and entirely downloadable from the internet. The firmware described in this application note is entirely available; to obtain a copy please contact your closest ST office. 5.1 Basic initialization of peripherals and I/O pins At the beginning of the main program, all the peripherals and I/O pins are configured as described below: ● The Clock source is selected in order to have the maximum frequency by means of an external 24 MHz oscillator. ● GPIO PINs are configured for: ADC channels (floating input) and I/Os. ● TIMER (TIM1) configuration: Ch1, Ch2, Ch3, and Ch4 are configured in center aligned mode and provide an AD triggering signal to ADC for conversion by TRGO. ● ADC Configuration: AIN8, AIN9, AIN10, AIN11, and AIN12 are converted one by one during the “update” event forced by TIM1. Single shot conversion has been set. Other firmware settings are for interrupt and joystick/pushbutton management. The joystick, soldered onto the control section, is useful in debug phase to change the PI gains. This feature is implemented on a low priority interrupt. 5.2 Peripheral settings The main peripheral settings are: ● Clock configuration ● TIM1 configuration ● ADC configuration The clock configuration is related to the PRESCALER by means of the function: /* Configure the Fcpu to DIV1*/ CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV1); The TIM1 configuration is: TIM1_DeInit(); TIM1_TimeBaseInit(0,TIM1_COUNTERMODE_CENTERALIGNED1, PWM_PERIOD,5); |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |