PDA

View Full Version : sleep dependant on 12v source



BTlab
- 14th February 2007, 10:10
Hi all,
Im currently building an automotive project using a 16F876, and I'm nearing completion but one last thing is that I want the pic to sleep when it is not receiving power from accessory (+12v), so that the variables do not get erased when the car is switched off
the project contains an LCD which I also wish to shut down.

what is the best way to acheive this? would I have to run the 12v through another regulator or can it be done some other way?

code wise I guess I just use port change interrupt?

BobK
- 14th February 2007, 15:38
Hi BTlab,

Why don't you just write your variables to eeprom just before the power to the PIC dies then read them back into your program when the PIC powers up again? Use the READ and WRITE commands. You should also have an input that monitors the incoming power supply and put a 100uF capacitor across the PICs power to keep alive long enough to store the variables in memory. I believe there have been previous questions about this on the forum in the past.

HTH,

BobK