Pages: [1]   Go Down
Author Topic: wake up on interrupt?  (Read 358 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 5
Posts: 207
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Switzerland
Offline Offline
Sr. Member
****
Karma: 6
Posts: 375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: