How can I reduce MCU consumption? (s08)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How can I reduce MCU consumption? (s08)

544 次查看
mehdializadeh
Contributor II

I am using MC9S08DZ96 microcontroller. Normally, when the program is running, 30 milliamps of current is consumed. I know I have to put the MCU in sleep mode. For this, I wrote a function that sets the relevant registers.

 

void stop3(){
	setReg8(SOPT1, 0x20U);                
	setReg8(SOPT2, 0x00U);                
	setReg8(SPMSC1, 0x1CU);               
	setReg8(SPMSC2, 0x00U); 
}

 


And now, with the `asm(stop);` command, I will take the MCU to sleep mode. I want the current consumption to reach 10 milliamps by lowering the clock and disabling different parts of the microcontroller.
With this method I have done, the current consumption did not decrease. Can anyone help me?


0 项奖励
回复
1 回复

531 次查看
mehdializadeh
Contributor II

This problem was solved. Instead of calling function `_EntryPoint` again, I wrote a function in file `main.c` and called this function before the command `asm(stop);` 

 

void stop3(){
setReg8(SOPT1, 0x20U);
setReg8(SOPT2, 0x00U);
setReg8(SPMSC1, 0x1CU);
setReg8(SPMSC2, 0x00U);
}

 



Then, In `main()` I called above function:

 

while(1){
    if (T_Timer >= 10000){
    stop3();
    asm(stop);
    }
}

 


With this, the normal consumption, which was 60 milliamps, was reduced to 40 milliamps. which, if we don't consider that the LEDs of the circuit are on, it will significantly reduce the consumption.

0 项奖励
回复