avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] Power-down mode at mega128L


From: John Yannakopoulos
Subject: [avr-gcc-list] Power-down mode at mega128L
Date: Tue, 19 Oct 2004 16:40:49 +0300 (EET DST)

Hi all!

I'm putting mega128 in power-down or power-save mode, but unfortunately
MCU cannot prevent from wake-up. For powering down MCU, I'm using the
following routine:

void my_sleep (void)
{
  MCUCR |= BV (SE);
  MCUCR |= BV (SM1); // for entering power-down
  MCUCR |= BV (SM1) | BV (SM0); // for entering power-save
  asm volatile ("sleep" ::);
}

The point I call that routine is as follows:

while (1) {
        if (queue_empty ()) {
                my_sleep ();
                asm volatile ("nop"::);
                asm volatile ("nop"::);
        }
}

Additionally, I have configure Timer0 to operate on Asynchronous mode
(with a 32KHz external clock), and generate an overflow interrupt every
7.6 ms approx. (i.e., with a 30 us tick -> no prescaling). I have read the
manual, but I cannot find out what is going on. Any suggestions?

Thanks in advance,

--
John.


reply via email to

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