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

  • 相关阅读:
    如何手动封装 $ on off emit?
    Vue 实例身上的一些方法(二)
    Vue 实例身上的一些方法(一)
    Vue属性过滤
    Vue属性监听
    Vue实现简单的商品增减功能
    Vue 计算属性
    使用Vue实现一个简单地自定义拖拽功能
    数组的深拷贝与浅拷贝
    如何让html引用公共布局(多个html文件公用一个header.html和footer.html)
  • 原文地址:https://www.cnblogs.com/huangbaobaoi/p/7903415.html
Copyright © 2011-2022 走看看