How can I reduce MCU consumption? (s08)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How can I reduce MCU consumption? (s08)

475件の閲覧回数
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 返信

462件の閲覧回数
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 件の賞賛
返信