The Timer1 oscillator will continue running while the chip is in sleep mode.
With a 32768hz crystal, you'll get an interrupt every 2 seconds. (More accurate than the main crystal)
When the PIC wakes up (at the normal OSC speed), you simply update the time then go back to sleep. Batterys will last months.
You don't actually need to use interrupts. If the GIE bit is clear, it will just resume where it left off, so it never leaves the main loop.
DT
Bookmarks