This is a multi-part message in MIME format. ------=_NextPart_000_003E_01C37A0C.461B5B20 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Auto poweron/poweroff is a perennial. Here's a post message I posted in April based on something posted in .... This is based on a circuit I have in successful use in a low volume production specialist item. I could give you (Jinx) a PCB to populate to try it if you wished. This draws NO measurable current when off, starts on a button press and subsequently allows the button to be used as an input. Russell McMahon ________________________________________ > 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) Here's an attempt to meet your full specification. I haven't tried it and it's not fully designed yet but I think a little thought and/or playing would make a reliable working circuit from it. There are too many requirements on the single pin to allow a simple digital 0/1 full rail signal level to be used. Roman Black recognises this in his SCR design and "cheats" by making the turnoff function independent of the pin - in his cct the PIC reduces its current consumption below the SCR hold on current. This is a clever and legitimate solution but will not work in cases where there is other circuitry drawing current in excess of the SCR holding current. My solution also uses a "trick" - but using the PIC pin to do it. Transistor TR2 is held on by R3+R4 BUT the voltage at the junction of R3 & R4 is a LOGICAL low level which the PIC can read. When the button is operated after startup the PIC pin sees a logical high. To turn the circuit off the PIC (or other cpu) takes R3/R4 junction to ground. Proper design may wish to see a small series resistor to avoid possible damage from the 100uF capacitor discharging into the pin. The true low level turns off TR2 and initiates shutdown. Somewhere along the way the PIC will lose the ability to maintain an active low output and C1/R3 must have a long enough time constant to hold the transistor off after this. The time that the voltage into the regulator (on capacitor C7) stays actively high will be an important factor in turn off. Suitable care and thought would definitely turn up a working combination but odds are that as shown the component values are wrong. If the regulator has a substantial output capacitor but a smaller input cap, the PIC may be designed to stay alive after TR3 is turned off. This would ensure the circuit is well shut down before the PIC expires. PIC "death throes" need to be carefully thought through - as is always the case in this sort of circuit. Z1 stops PIC pin being taken illegally high. R5 provides turn off for TR2 in absence of other drive sources. R3/R4 divider, which holds TR2 latched on, must provide low enough output to place a logical 0 on PIC pin, while R7/R4 divider provides a logical high. R7 sized to provide enough level for a logical 1 - higher voltages will be clamped by Z1. D3 left over from a prior circuit - does no harm but Z1 probably sufficeth at 4v7. C1 value should be as low as reasonably possible consistent with turn off timing requirements. R4 can be made much larger (depending on transistor beta, load current supported etc) - allowing scaling up of other resistors allowing smaller C1 Russell McMahon ---------------------------------------------------------------------------- ---- -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body ------=_NextPart_000_003E_01C37A0C.461B5B20 Content-Type: image/gif; name="Psw1pin.gif" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Psw1pin.gif" R0lGODlh7gEeAYAAAAAAAP///yH5BAAAAAAALAAAAADuAR4BAAL/jI+py+0Po5y02ouz3rz7D4bi SJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMKpfMpvMJjUqn1Kr1is1qt9yu9wsOi8fksvmM TqvX7Lb7DY/L5/S6/Y7P6/f8vv8PGCg4SFhoiAGQCICgmEjTeLBoIHkoQXmpqEBZyXe5sPkCOhnJ aUk6ijopWnrnqTmz6srqICubOosH+froeBqwiuuL2csYnLcYm+OJbNzATJrcbCcpChyz/Cv9mX1a rV1nyw2bWWwtDWpL/r3O3u7+Dh8vP89WS/x7z1p9H07fEi1OVwJ0/AQ2MsfDlcJz6ITd8uciFjKA qoo9bJhk4UBt/xiJPYMII9lHi6M2UcPo64hGksYafswH8t+2kfgsmsyGUhVMIS93NSOYimbMFQCL GqS2kQHChAG7nQi3FAvKlUOJbnuI9ebFpOKKEDS5s0O/Mep0koxa9cNBhzop4vM2MGycdF/Rpr3b 5aDevSSgohrbbq/cQ4ILGz6MOLHixYURMbZrQSjSpvMatzwDOUJmDpL/poRnOYjBz/s2a7Bmmgrq shBSn9bkaHLXYI8V3yjKaKoKua6lRLXbe0RwQbUT3746G7VVpZg1TxgeAjrea/xIM1+OnAzCwT5t SB9SHHEraMmzp1DuM2fEz2Kdm8LxnWd04dxp1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