Hello,

I'm hoping someone can point me in the right direction here.

PIC16F628A
4MHz crystal
Battery powered

At the moment I have a program that basically naps most of the time over approx 1.5 seconds then awakens to power a receiver to check RB0 for a qualifier byte and match the following byte against a constant. Every cycle it increments a word size counter that in turn increments another byte size counter to exend the overall time-count to three days. Every so many cycles it also checks the PIC battery. After three days the program shuts-down. This seemed O.K. but with a timeout on the Serin as long as the receivers picking something up either modulated or random noise the timeout doesn't expire and the count goes out the door. The Serin timeout not timing out isn't an overly bad thing in that the receiver PIC has to get in sync with the transmitters signal but a constant source of random noise could keep it forever active.

I want to have the WDT on for the Nap command as it's battery powered so after fumbling through the datasheet and application notes my confused mind asks for help on the timers.

I don't really know what to do to ensure an accurate and by accurate I mean a +- 1 minute three day overall time count with the Serin timeout but as I type this I can see from an App-note that I could keep the WDT on with Timer1 in Asynchronous Counter Mode and using an external 32.768 oscillator (prescale of 2 for 4 seconds) have an over-flow of the TMR1 register cause an Overflow Interrupt and an interrupt service routine can make sure to turn off power to the receiver (if it's still on from the failed Serin timeout) and increment the counters for the three day overall timeout and battery check.

Does this sound about right? If not what do you suggest? I know it's certainly easier for me to type out than to do as I haven't had to do anything like it before. Any pointers in the right direction greatly appreciated as it makes searching the archive easier when you know what to look for.

Regards,

Andrew.