a regular 16F628, depending of the crystal speed, is suppose to work from 3V to 5.5V. Detecting a 3V may work great or not. What i'll personnaly do is to use the 16LF628 wich work down to 2V. That's my own opinion.
What i usually do, and some may have another opinion, is to use an LF serie and a LDO voltage regulator. This give me a stable voltage reference to compare against the battery voltage. That way it work.
One way to do it...
Datasheet section 9.1 use mode 101 (one comparator)
Poll C2OUT bit of CMCON
OR Interrupt
Enable Comparator interrupt (see PIE1 register 4.2.2.4)
.
.
.
your code.
.
.
.
Interrupt routine
Blink your LED
Clear Comparator interrupt flag CMIF (PIR1 register 4.2.2.5)
Resume Interrupt.
Without any voltage regulator it's not impossible but you need a stable voltage reference... i remind one of my bench stupid idea in the past : use an I/O to supply a Resistor + Zener Diode for the voltage reference... worked. But as Zener diode need few mA to work properly... it's not suitable for a battery powered system... IMHO
Last edited by mister_e; - 25th April 2006 at 05:08.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks