zoukankan      html  css  js  c++  java
  • 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.

    Figure 1. Hardware block diagram

    2 Sleep mode

     

    3 I/O current injection susceptibility

     

    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();
    }
    }

  • 相关阅读:
    webpy使用笔记(一)
    如何衡量离散程度
    Hash哈希(二)一致性Hash(C++实现)
    Hash哈希(一)
    sqlmap使用笔记
    Windows7 IIS7.5 HTTP Error 503 The service is unavailable 另类解决方案
    [转]IP动态切换脚本
    全国各地电信DNS服务器地址
    比较好的汉字拼音化类
    c#读取INI文件类
  • 原文地址:https://www.cnblogs.com/huangbaobaoi/p/7903415.html
Copyright © 2011-2022 走看看