stsw-stm8053
所属分类:嵌入式/单片机/硬件编程
开发工具:C/C++
文件大小:33KB
下载次数:9
上传日期:2014-05-09 14:52:05
上 传 者:
cainiaojia
说明: STM8S单片机关于省电模式的各种应用以及代码
(STM8S microcontroller applications on a variety of power-saving mode and code)
文件列表:
Active_HALT_mode\active_halt.stp (15144, 2008-10-09)
Active_HALT_mode\Active_HALT.stw (211, 2009-01-15)
Active_HALT_mode\Active_HALT_main.c (1728, 2008-12-05)
Active_HALT_mode\Active_HALT_vector.c (3853, 2008-12-05)
Active_HALT_mode\conf.h (2619, 2008-12-05)
Common\Power_management.c (8433, 2009-01-15)
Common\Power_management.h (2185, 2009-01-15)
Common\STM8S208M.h (23052, 2008-12-05)
HALT_mode\conf.h (2468, 2008-12-05)
HALT_mode\halt.stp (15030, 2008-12-05)
HALT_mode\HALT.stw (197, 2009-01-15)
HALT_mode\HALT_main.c (1626, 2008-12-05)
HALT_mode\HALT_vector.c (3474, 2008-12-05)
RUN_mode\conf.h (2917, 2008-12-05)
RUN_mode\FLASH_exec.lkf (1512, 2008-10-02)
RUN_mode\RAM_exec.lkf (1519, 2008-10-02)
RUN_mode\Reference_codes.c (11273, 2008-12-05)
RUN_mode\Reference_codes.h (1560, 2008-12-05)
RUN_mode\run.stp (17325, 2008-11-21)
RUN_mode\RUN.stw (195, 2009-01-15)
RUN_mode\RUN_main.c (2994, 2008-12-05)
RUN_mode\RUN_vector.c (3130, 2008-12-05)
WAIT_mode\conf.h (2080, 2008-12-05)
WAIT_mode\wait.stp (15040, 2008-12-05)
WAIT_mode\WAIT.stw (197, 2008-12-05)
WAIT_mode\WAIT_main.c (1669, 2008-12-05)
WAIT_mode\WAIT_vector.c (3470, 2008-12-05)
/********************************************************************************/
/* STM8A/S */
/* AN2857 AN2743 */
/* STM8A/S family power management application note */
/* README text file */
/* V1.0.0 */
/* */
/********************************************************************************/
/* THE PRESENT FIRMWARE, WHICH IS FOR GUIDANCE ONLY, AIMS AT PROVIDING CUSTOMERS*/
/* WITH CODING INFORMATION REGARDING THEIR PRODUCTS SO THEY CAN 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. */
/********************************************************************************/
This file explains how to use the code attached to the AN2743 (STM8A devices) and
AN2857 (STM8S devices) to take power consumption and wake-up time measurements.
This code works only with Cosmic compiler.
The code is based on 'include' files of STVD. These files must be included in
the user's project. The include files are located in the folder:
"STMicroelectronics\st_toolset\include". To include them, proceed as follows:
- Copy and paste the include files into your working folder, OR
- Configure STVD to automatically look for include files in the folder name
given above. Then, go to the menu tools/option/directories and select the STM8
cosmic toolset and include the files. Finally, add the folder where all the
include files are located.
The main configurations are done using the 'conf.h' file. For basic measurements
the user does not have to modify any source files. The only code which has to be
modified is in the conf.h file. This file acts as a 'dashboard'.
To download the code into the MCU, the user must use STVP or the 'light programmer'
in STVD. The user must never load the code into the MCU through a debug session.
For taking power consumption measurement user has to configure the conf.h according
to its need, then configures the Option bytes accordingly (through STVP). For
low-power mode measurement, user has to insure that there is a pull-down resistor
on the PB5 pin. This pin (configured as floatting input) is used for receiving the
external event which wakes-up the micro from the low power mode (WAIT, HALT, Active
HALT).
For taking wake-up time measurements, the user has to monitor the PB1 pin. This pin
toggles when the interrupt routine is executed. To wake-up the MCU from low-power
mode, a rising edge has to be applied on the PB5 pin.
The conf.h file allows the user to:
- Select the output value on the GPIO during the measurement.
It should be either 0x00 or 0xFF
- Select the clock sources:
HSE: The option bit EXTCLK has to be properly configured if a crystal or
external clock is used.
HSI
LSI: The option bit LSI_EN has to be set to enable the LSI clock as the CPU
clock otherwise the code stops when LSI is selected.
- Select the clock prescaler factors:
CPU_DIV
HSI_DIV (when HSI is selected as the clock source).
- Select if the CPU clock is outputted on the MCO output.
Note that consumption increases when the clock is outputted on a pin. This is
because the CCO IO is working.
- Select the reference code (for run mode only).
There are two reference codes available for taking run mode power measurements:
LINEAR: This code is an infinite loop which executes the same instruction sequence
one hundred times. It is very linear and benefits from the prefetch buffer.
USER: This code is an endless loop which executes nothing. The user must write
his/her own code inside the infinite loop.
- Select the code location (for run mode only).
The reference code can be executed from two memory locations:
FLASH: The reference code starts at the address defined in the FLASH_exec.lkf
linker file. This address is 0x8400. To execute the reference code
from the Flash location, the conf.h file has to be properly configured and
the FLASH_exec.lkf file has to be selected as the linker file.
RAM: The reference code starts at the address define in the RAM_exec.lkf
linker file. This address is 0x0100. To execute the reference code
from the RAM location, the conf.h file has to be properly configured and
the RAM_exec.lkf file has to be selected as the linker file. The execution
time is longer When the code is executed from the RAM location.
Note: Proceed as follows to select the linker file:
- Open the 'project settings' window (Alt+F7)
- Click on the linker menu
- Select 'input' as the category
- Fill the 'script lkf file name' with the correct file name, which is either
FLASH_exec.lkf or RAM_exec.lkf.
- Select the Flash state (for halt and active halt only).
The Flash can be in operating or power down mode.
- Select the MVR state (for active halt only).
The MVR can be either 'on' or 'off' (the LPVR is automatically used when teh MVR is off).
近期下载者:
相关文件:
收藏者: