2017.11.27 stm8 low power-consumption debugging

1 STM8L+LCD

The STM8L-DISCOVERY helps you to discover the STM8L ultralow power features and to

develop and share your applications. It is based on an STM8L152C6T6 and includes an

ST-Link embedded debug tool interface, LCD (24 segments, 4 commons), LEDs and push

buttons.

2017.11.27 stm8 low power-consumption debugging_第1张图片

                                                                                                                   Figure 1. Hardware block diagram

2 Sleep mode

2017.11.27 stm8 low power-consumption debugging_第2张图片
2017.11.27 stm8 low power-consumption debugging_第3张图片

3 I/O current injection susceptibility

2017.11.27 stm8 low power-consumption debugging_第4张图片
2017.11.27 stm8 low power-consumption debugging_第5张图片

4 Low-power coding

                  The key is turn off   I/O

void sleep_enter(void)

{

//off LCD

disableInterrupts();

prog_enter_sleep();

disp_enter_sleep();

LCD_Com_Page(0);

LCD_Cmd(DISABLE);

//disable 16Hz

RTC_WakeUpCmd(DISABLE);

GPIO_Init(POWER_12V_PORT,POWER_12V_PIN,GPIO_Mode_In_PU_IT);

//disable ADC Clock

CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, DISABLE);

enableInterrupts();

}

void sleep_exit(void)

{

disableInterrupts();

key_init();

temper_init();

//disable 16Hz

RTC_WakeUpCmd(ENABLE);

//disable ADC Clock

CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);

//off LCD

LCD_Cmd(ENABLE);

GPIO_Init(POWER_12V_PORT,POWER_12V_PIN,GPIO_Mode_In_PU_No_IT);

enableInterrupts();

ADC_SoftwareStartConv(ADC1);

key_flag.f.disable=1; //clear the default key input

sys_time_load();

}

void sleep_func(void)

{

if((GPIO_ReadInputData(POWER_12V_PORT)&POWER_12V_PIN)==0){

sleep_enter();

_sleep_loop:

if((GPIO_ReadInputData(POWER_12V_PORT)&POWER_12V_PIN)!=0){

goto _sleep_exit;

}

halt();

if((GPIO_ReadInputData(POWER_12V_PORT)&POWER_12V_PIN)==0){

goto _sleep_loop;

}

_sleep_exit:

sleep_exit();

}

}

你可能感兴趣的:(2017.11.27 stm8 low power-consumption debugging)