At 08:49 AM 4/28/03 -0400, Bob Ammerman wrote: >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. This will work *only* if the PIC pin is open drain. Otherwise, the clamping diode from pin to Vdd will both attempt to power the PIC via the diode as well as (possibly) keep the transistor turned ON. dwayne -- Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 19 years of Engineering Innovation (1984 - 2003) .-. .-. .-. .-. .-. .-. .-. .-. .-. .- `-' `-' `-' `-' `-' `-' `-' `-' `-' Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- 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