seemanta
Member level 4
Power down mode problem with timer 0 int - solution found!
Hi,
I have observed that after going to sleep and waking up, my timer 0 interrupt handler does not get called.
My problem is this:
My micro receives an external interrupt every second from a real time clock. This external interrupt is tied to /INT0 of the micro.
I need to light up an LED for 10 seconds(visual alarm). I calculated how many times timer 0 would overflow in 10 seconds. Let us call this count 'n'. Then in my timer 0 ISR, I keep a count how many times the ISR was called. When this number matches 'n' I know that 10 seconds have elapsed and then I shut the LED down.
The problem I am facing is that if I go to power down mode between the RTC interrupts, my LED keeps on blinking and never stops. Basically the count 'n' is never reached.
However, if I choose to go to idle mode instead of power down mode, everything works and my LED does not light up after 10 seconds.
Somehow I believe that this is due to the oscillator stopping in power down mode and not stopping in idle mode. But I am not able to figure out the exact connection.
Can anyone please suggest what is happening here?
Thanks in advance!
regards,
Seemanta
Added after 2 hours 13 minutes:
I got the cause of this problem! Just wanted to share with the rest of the edaboard'ians.
Well, since the oscillator freezes between each interrupt, the TH0 and TL0 registers also freeze during the time the micro remains in power down.
That is why the whole thing effectively slows down, since to reach the count 'n'the micro has to spend more time than it would have spent with the oscillator running all the time.
I guess, this is the first time someone has posted the problem and the solution as well!
Hope this will help anyone in the future facing the same problem as
I too faced!
regards,
Seemanta
Hi,
I have observed that after going to sleep and waking up, my timer 0 interrupt handler does not get called.
My problem is this:
My micro receives an external interrupt every second from a real time clock. This external interrupt is tied to /INT0 of the micro.
I need to light up an LED for 10 seconds(visual alarm). I calculated how many times timer 0 would overflow in 10 seconds. Let us call this count 'n'. Then in my timer 0 ISR, I keep a count how many times the ISR was called. When this number matches 'n' I know that 10 seconds have elapsed and then I shut the LED down.
The problem I am facing is that if I go to power down mode between the RTC interrupts, my LED keeps on blinking and never stops. Basically the count 'n' is never reached.
However, if I choose to go to idle mode instead of power down mode, everything works and my LED does not light up after 10 seconds.
Somehow I believe that this is due to the oscillator stopping in power down mode and not stopping in idle mode. But I am not able to figure out the exact connection.
Can anyone please suggest what is happening here?
Thanks in advance!
regards,
Seemanta
Added after 2 hours 13 minutes:
I got the cause of this problem! Just wanted to share with the rest of the edaboard'ians.
Well, since the oscillator freezes between each interrupt, the TH0 and TL0 registers also freeze during the time the micro remains in power down.
That is why the whole thing effectively slows down, since to reach the count 'n'the micro has to spend more time than it would have spent with the oscillator running all the time.
I guess, this is the first time someone has posted the problem and the solution as well!
Hope this will help anyone in the future facing the same problem as
I too faced!
regards,
Seemanta