Go Down

Topic: wake up on interrupt? (Read 2191 times) previous topic - next topic


Is it possible to wake up on a timer overflow interrupt? I'm making a clock and using timer 2's asynch capabilities to count from an external 32 khz crystal. Since it will be battery powered, I want to put the MCU to sleep as much as possible and only wake up to increment the second counter. Is it possible?


Sure.  See chapter 9 of the data sheet, and http://www.nongnu.org/avr-libc/user-manual/group__avr__sleep.html.
A while ago I posted some example sleep code which uses the watch-dog timer to wake up (http://arduino.cc/forum/index.php/topic,92840.msg744375.html#msg744375).  But the watch-dog isn't terribly accurate, so you'd probably want the "power-save" mode rather than the "power-down" mode.  This mode leaves the timers running, and a Timer2 overflow or output-compare event can wake the CPU -- see the TIMSK2 register description in the datasheet.

Go Up