CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Using push button for On/Off

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Sid2286



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

Using push button for On/Off
PostPosted: Tue Feb 15, 2011 3:10 am     Reply with quote

Hi,
I was wondering how to use a push button for On and Off Application. Just like how it is in laptops or computers.
i'm out of ideas...please help...I don't want to use a slide switch.

Regards,
Sid
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Feb 15, 2011 6:58 am     Reply with quote

Keep track of the current state, either On or Off. When the button is pressed, and the press is qualified by whatever switch debouncing* you choose to use, change the current state to the other state.

* Note that mechanical switches tend to bounce when pressed and give a quick series of switch closures. One simple debouncing method would be to sense the switch close, then wait 10ms and see if the switch is still closed before deciding this is a single valid switch closure.
_________________
The search for better is endless. Instead simply find very good and get the job done.
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Tue Feb 15, 2011 8:23 am     Reply with quote

I'm assuming that you're asking about a circuit where you could turn a system on with a pushbutton, then turn it off again with the same button. This doesn't do exactly that, but it does allow a processor to control its own power. You could easily add an "off" button to the processor, telling it to kill its own power, or you could add circuitry to monitor the "on" button so if it's held for 5 seconds, that would also tell the processor to kill power, once the button is released. The circuit is designed to be mounted in a hand-held box where conductivity through the user's skin would turn power on, so it's sensitive to low currents.

Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group