use a timer (watchdog) interrupt + resistive voltage divider. one side of your voltage divider go to the battery, the other side (wich is suppose to go to GND) will go on a extra I/O. When your PIC wake up of the timer interrupt or sleep, or WDT or whatever else, you configure this i/o as output and send this PIN to GND, then take the battery reading. Once done, you turn this i/o to input and go back to sleep.
Another method is to use high value resistors (few hundreds Kohms) and use analog comparator interrupt.
16F876 is probably not the best choice for a battery opeated system. a LF serie could be better. 18F even better.
Last edited by mister_e; - 3rd December 2006 at 21:34.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks