by NickH » Tue Feb 10, 2009 7:29 pm
Hi David,
When everything's powered down, voltage at the gate (and the whole middle part of the circuit) will be 12V (Vgs = 0); hopefully no current flows anywhere. When the switch and/or the NMOS transistor is on, a voltage divider is formed, and gate voltage goes to about 6V (Vgs = -6V relative to the source, because the source terminal is more positive), turning the PMOS on to conduction.
BTW my resistor values were off the top of my head. I don't think they're critical. The middle 33K resistor could probably be reduced, if it was a 9V battery or you wanted larger -Vgs. But don't omit it altogether, as it helps prevent a short in case of component failure... A fuse on the battery terminal might be a good idea, too.
It should work as it is, but if your digital logic thrashes around during power-down* I guess it's possible you might need to reduce the 2.2K resistor or put some kind of filter on the control signal.
Nick
* Anybody know if FPGAs can misbehave when the power fails?