[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] ?starting program after getting up from power down?

From: Alexei Govorukhin
Subject: Re: [avr-gcc-list] ?starting program after getting up from power down?
Date: Thu, 5 Dec 2002 10:29:55 +0100

Hello Juraj,

Try to use Watch dog timer (WDT).
right after sleep command, initialize WDT and make forever cycle like

 // here must be wake up event set

 sbi(MCUCR,SE); // enable deep sleep mode
 do {
     // go to sleep here
     asm volatile ("sleep");    // go to sleep
     } while(!bit_is_clear(PINE,BTN_ROW1));     // back to sleep if not 
keyboard wakeup
 // goodmorning, we just woke up
 delayms(200);                                  // debounce key
 wdt_enable(3);                         // give some time for eeprom write 
complete before reset
 while (1);

Proc will be reseted by WDT. The while condition here is for control
that we wake up from specific key, and not on any other reason.
I hope that this helps, and sorry for my english,

Thursday, December 05, 2002, 6:50:02 AM, you wrote:

JB> Hi friends,

JB> I have running program in AVR. In some condition AVR gets into the power
JB> down mode. Before sleeping all necessary bits were enabled, to wake up by
JB> externel interrupt.
JB> ...
JB> Now I want to wake up AVR by ext. interrupt and start the program from
JB> beginning.
JB> When ext. interrupt occurs, external interrupt routine is called. My
JB> solution was, jump to address 0x0000 in this routine, but I do not know if
JB> it is correct solution, because interrupt routine was not finished,
JB> including getting values from stack and RETI instruction. I hope after
JB> starting program from address 0x0000, all registers and setting are
JB> initialized again.

JB> Does someone any other - better ideas?

JB> Thank you very much.

JB> Juraj Buliščák, OM8ACE

JB> avr-gcc-list at http://avr1.org

Best regards,
 Alexei                            mailto:address@hidden

avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]