Oops: I see an error in the circuit: The PIC pin can end up at greater than Vcc - this is not good. This would work OK if you used the open drain pin that is on many PICs (if Vbat is not greater than the max voltage specified for that pin). Bob Ammerman. When the ----- Original Message ----- From: "Bob Ammerman" To: Sent: Monday, April 28, 2003 8:49 AM Subject: Re: how to detect "ON" button in this auto-off circuit > 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. > > Bob Ammerman > RAm Systems > > -- > 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 > > > -- 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