Skip to main content
Visitor II
September 24, 2019
Question

is this the right code to low power for stm8l152

  • September 24, 2019
  • 0 replies
  • 436 views
void main(void)
{
 
 float temperature = 0;
 const float Rp=10000.0; //10K
 const float T2 = (273.15+25.0); //T2 298.15
 const float Bx = 3380.0; //B
 const float Ka = 273.15;
 float Rt = 0;
 //double d_num = 0;
 float ln_value = 0;
 
 int tmp_int1 = 0;
 int tmp_int2 = 0;
 float tmp_frac = 0;
 int record_cnt = 0; // record counter
 
 
 //uint16_t read_cnt = 2;
 //short int rd_data = 0;
 
 uint16_t k_addr = 0;
 
 //write to eeprom temperature
 
 
 CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_8);
 
 
 //CLK_GetClockFreq(void)
 //GPIO_Init(GPIOA, GPIO_Pin_2, GPIO_Mode_Out_PP_Low_Slow); // for test
 
 //TIM1_Config();
 
 LCD_Cmd(DISABLE);
 CLK_PeripheralClockConfig(CLK_Peripheral_LCD, DISABLE);
 RTC_Config();
 //ADC1_setup();
 
 //PE7
 
 
 
 
 
 
 
 
 
 while(1)
 {
 
 
 
 
 
 RTC_SetWakeUpCounter(SAMPLE_TIME * 60);
 RTC_WakeUpCmd(ENABLE);
 
 
 LCD_Cmd(DISABLE);
 CLK_PeripheralClockConfig(CLK_Peripheral_LCD, DISABLE);
 //TIM1_Cmd(DISABLE);
 //TIM1_SetCounter(0);
 //sEE_DeInit();
 
 
 
 //printf(VERSION);
 
 
 
 
 
 //PWR_UltraLowPowerCmd(DISABLE);
 halt();
 
 RTC_WakeUpCmd(DISABLE);
 //RTC_ClearITPendingBit(RTC_IT_WUT);
 
 
 
 
 
 
 }
}

we measure 70-80uA

    This topic has been closed for replies.