[STM8] stm8l功耗下不来什么情况

[复制链接]
1624|9
 楼主| xianhaidanxin 发表于 2016-5-13 18:58 | 显示全部楼层 |阅读模式
最近做一个stm8l的项目,功耗始终下不来,求大神帮忙看看
主程序如下:
#include "stm8l15x.h"
#include "stm8l15x_gpio.h"
#include "led.h"
#include "ADC.h"
#include "stm8l15x_pwr.h"
#include "stm8l15x_it.h"




void main(void)
{
  LED_Init();
   
  PWR_FastWakeUpCmd(ENABLE);  //快速唤醒使能

  GPIO_Init(LED6_B_PORT, LED6_B_PIN, GPIO_Mode_In_PU_IT);//初始化按键,GPB6带上拉带中断输入
  
  EXTI_DeInit(); //恢复中断的所有设置
  EXTI_SetPinSensitivity (EXTI_Pin_0,EXTI_Trigger_Rising);//外部中断0,上升沿触发,向量号8
  GPIO_Init( GPIOA, GPIO_Pin_All, GPIO_Mode_In_PU_No_IT);
  GPIO_Init( GPIOC, GPIO_Pin_All, GPIO_Mode_In_PU_No_IT);
  GPIO_Init( GPIOB, GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7, GPIO_Mode_In_PU_No_IT);
  GPIO_Init( GPIOD, GPIO_Pin_All, GPIO_Mode_In_PU_No_IT);
  enableInterrupts();//使能中断
  
  PWR_UltraLowPowerCmd(ENABLE);//超低功耗
  
  while(1)
  {
    halt();
  }
}

中断处理程序如下:
INTERRUPT_HANDLER(EXTI0_IRQHandler,8)
{
    /* In order to detect unexpected events during development,
       it is recommended to set a breakpoint on the following instruction.
    */
  
    EXTI_ClearITPendingBit (EXTI_IT_Pin0);
    disableInterrupts();//使能中断
   
    ADC5_Init();
    Value5=ADC5_Value();
      
    ADC6_Init();
    Value6=ADC6_Value();
   
    Value0=((Value6*10/Value5)-10);

    if(Value0<80)
    {
      LED_Off();
      LED_Hot();
    }
      else if(Value0>80 && Value0<120)
      {
        LED_Off() ;
        LED_Warm();
      }
        else if(Value0>120)
        {
          LED_Off() ;  
          LED_Cold();
        }   
}
nyszx 发表于 2016-5-14 20:42 | 显示全部楼层
外设用完关闭试试看
mmuuss586 发表于 2016-5-15 11:15 | 显示全部楼层
现在功耗是多少呢?
Stannis 发表于 2016-5-15 20:27 | 显示全部楼层
正常进入低功耗没
可可球 发表于 2016-5-15 22:17 | 显示全部楼层
功耗多少,不用的外设关掉
 楼主| xianhaidanxin 发表于 2016-5-16 17:40 | 显示全部楼层
可可球 发表于 2016-5-15 22:17
功耗多少,不用的外设关掉

1.4mA
 楼主| xianhaidanxin 发表于 2016-5-16 17:49 | 显示全部楼层
可可球 发表于 2016-5-15 22:17
功耗多少,不用的外设关掉

1.4mA
734774645 发表于 2016-5-16 21:44 | 显示全部楼层
不用的外设是可以关掉电源的。
xmshao 发表于 2016-5-17 11:40 | 显示全部楼层
仔细确认下每个外设甚至每根脚。

再就是别把别的功耗算在MCU上。
lulugl 发表于 2016-7-23 00:56 | 显示全部楼层
楼主,你把外设去掉,然后就跑低功耗测试一下,看节能模式是不是对的,我做过节能模式是0.8微安那样子
您需要登录后才可以回帖 登录 | 注册

本版积分规则

5

主题

24

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部