
Originally Posted by
Darrel Taylor
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
How would you keep track of the time without using interrupts?
This is the way I was thinking:
Timer1 with 32.768kHz OSC who's interrupt routine increments the time variables.
main:
[ code to check time variables, update LCD, etc ]
NAP
goto main
And have the WDT off so that it only wakes up when the Timer 1 interrupt triggers.
Does that sounds like it should work?
"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
Bookmarks