I recently made a low battery warning for a 12V lead acid battery using a 12F675. B+ 12V powers the PIC through a 3.3V LDO regulator.The same B+ 12V goes to the ADC pin through a 220K resistor. The ADC pin then has 47K to ground. Here's the code I used. It flashes an LED when the battery gets weak. Perhaps you can tweak the code and circuit for your application to put the PIC in low power mode.
ANSEL = 0 'all inputs digital ADC command will convert it to analog
CMCON = 7 'comparators off
DEFINE OSCCAL_1K 1 ' Set OSCCAL for 1K device
TRISIO = %00000001 'INPUT ANA0 FOR ADC READINGS
GPIO = 0 'ALL OUTPUTS LOW
BATTEST VAR BYTE
@ DEVICE MCLR_OFF, WDT_ON, BOD_ON, PWRT_ON, PROTECT_ON
TEST:
Clear 'CLEAR BATTEST
ADCIN 0,BATTEST 'TEST CHARGE
IF BATTEST <= 166 Then GoSub BLINK
GoTo TEST
BLINK:
High GPIO.2
Pause 500
Low GPIO.2
Pause 500
Return
Bookmarks