Try only feeding the pic with a 1000uF capacitor when the power is cut and the switching from main to battery takes place.
How? leave the two diodes but after the regulator one for the battery, other for the regulated supply, add a 1000uf capacitor before the pic and raise the regulator voltage to keep the 5V
"...maybe could work" circuit diagram:

Is a good practice to make a power supply detection signal with a voltage divider or another diode after the regulator.
Also if i'm not wrong 16F877 will not work under 4.0 volts but similar ones work happy up to 2,0V like the LF version, saying that. change: or your pic, or your battery, or maybe a "low drop" diode will do the trick
Last edited by El_AMPo; - 29th December 2010 at 02:14.
"If at first doesn't work, kicking it wont help either"
Bookmarks