> Attached is a rather simple circuit which should work, I think. > When S1 is depressed, it turns on the transistor, and also charges C1. > As soon as the PIC starts up it sets the pin to output and drives it low. > This will latch on the power. > To sense the switch the PIC simply turns the pin momentarily into an input > and reads the state. C1 will hold the power on during this interval. > To turn off the power the PIC simple turns the pin into an input and waits > for C1 to discharge to turn off the power. Nice simple circuit. Has merit BUT a major concern is the "sneak path" when off from Vin via R2, R4 and diode to the PIC pin. You can probably achieve the desired result without this path with a bit more work. I thought about using a pulsed read design when I produced my version. The main disadvantage is that the key must be "polled" rather than allowing the level to be simply read or used as an interrupt source. There is very little difference between polling (with the need to set pin to input 1st) and just reading an existing input so I guess that the interrupt capability is the only real loss. One could always implement Roman's version but use 2 x transistors in place of the SCR. This gives you the capability to set the turn off current by suitable component choice. Russell McMahon -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics