avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] Interrupts from assync timer in sleepmode


From: Dmitry K.
Subject: Re: [avr-chat] Interrupts from assync timer in sleepmode
Date: Fri, 23 Sep 2005 09:06:28 +1100
User-agent: KMail/1.5

On Thursday 22 September 2005 17:15, Bjarne Laursen wrote:
> Hey list.
> I have a program that misses some interrupts on a mega128.
>
> I have an isr on output compare on an assyncrone timer. This will put a
> tast into a taskqueue.
> Then before i goto sleep, I check that my taskqueue is empty. This is
> with interrupt disabled.
> Just before enterng sleep i enable interrupt, so that no interrupt can
> come in between my check and the sleep-instruction.
[...]

If I have correctly understood, you forbid interruptions to not fall
asleep on operation 'sleep' if interruption will occur earlier.
As the usual decision manipulation serves in such situation with
SE bit: it should be set to 1 AFTER 'sleep' instruction before
timer reprogramming or AFTER 'sleep' instruction.  And, certainly,
yours ISR must clear SE bit.

Dmitry.

P.S.  Function 'sleep_mode' from Avr-libc clears SE after 'sleep'.
I do not understand, what for it is necessary. Personally I always
set SE to 1 after 'sleep' in main loop. 





reply via email to

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