Use Roman Black's auto circuit http://www.romanblack.com/self_swi.htm. Use your PIC Pin to read the switch via suitable voltage divider. Stuart ----- Original Message ----- From: "Ben Jackson" To: Sent: 27 April 2003 05:11 Subject: [EE]: how to detect "ON" button in this auto-off circuit > I'd like to > 1) Turn on the device by pressing a button > 2) Later be able to have the PIC turn itself off > 3) While the PIC is on, have it be able to detect "ON" button presses again > 4) Only use one IO pin (so gnd or +5v to switch off, high-impedance input > to detect button and stay on) > > This is what I sketched out: > > .----------------------o > | | > | ___ ___ |< > |-----|___|-o-|___|--| > | | |\ > | .----o | > | | | o > --- |o <| ___ | > - -| |-o|___|-o---o Vcc > | |o /| | > | | | | > | | | | > '------o----o---|----------o GND > | > | > o > PIC IOx > > I was thinking that the pullup on the NPN transistor would show up as > ~5v on the IO pin (which can be grounded to shut off), and I could add > some diodes in to use the same momentary/NO pushbutton to also ground > the base of the NPN (harmless, since at that point power would be held > on by the button also pulling down the base of the PNP) to detect the > button. > > Of course the voltage at the base/IO pin is close to zero since the > transistor is forward biased and most of the voltage is dropped in the > pullup resistor. > > Can anyone suggest a way to meet my original requirements? It just > occred to me that an N-FET instead of an NPN might work. > > Thanks. > > -- > Ben Jackson > > http://www.ben.com/ > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads