[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Sleeping Code
From: |
Ilhom Djalilov |
Subject: |
Re: [avr-gcc-list] Sleeping Code |
Date: |
Sat, 14 Feb 2004 16:29:38 +0500 |
Hello harshit,
Saturday, February 14, 2004, 2:48:10 PM, you wrote:
hs> Hi
hs> im trying to learn the sleep mode of the atmega128.
hs> The datasheet says that if an interrupt occurs when
hs> the cpu is sleeping. It wakes up -> executes interrupt
->> then executes the next instruction after the sleep
hs> instruction. So Does this mean that it wont go back to
hs> sleep again?
Yes.
hs> This is the code i wrote and the 8 bit timer produces
hs> interrupts on every overflow. so i made a infinite
hs> loop to keep sending the CPU back to sleep. If the
hs> while(1) loop wasnt there then the cpu would have woke
hs> up and stayed woken up . Is that correct?
Yes, it is correct.
hs> Please advise if I have written the code to send the
hs> MCU to sleep correctly. I saw a decrease in current
hs> draw(not toooo much though).
You will not get a big decrease in current draw, unless your sleep mode
is the "Power down" mode. But in this mode, only a small subset of
interrupts is availible.
hs> I have a feeling that
hs> there must be a better way to do it.
No other way exist.
--
Best regards,
Ilhom