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 support@ccsinfo.com

multi operation button

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



Joined: 02 Feb 2005
Posts: 9
Location: Finland

View user's profile Send private message

multi operation button
PostPosted: Sun Nov 20, 2005 12:09 pm     Reply with quote

Hello

I have connected buttons to RB4:RB5 pins and I like to use RB4 two different operations. Low time<1s reset function and low time>1s sleep prosessor. I use #INT_RB to read buttons and handle state changes in my program code. Question is what would be the easiest way to read time, how long RB4 is on low state? So does someone have sample code, how should I do it.

cheers
Jussi
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Sun Nov 20, 2005 1:18 pm     Reply with quote

Set up a timer to overfrlow every, say, 0.1s and count the number of interrupts n while the button is pressed. Stop counting when the button is released. If n<10 do something if n>10 do something esle. There is a lot of timer code listings in the forum.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sun Nov 20, 2005 8:22 pm     Reply with quote

Check out the code library
JPH



Joined: 02 Feb 2005
Posts: 9
Location: Finland

View user's profile Send private message

PostPosted: Tue Nov 22, 2005 6:29 am     Reply with quote

thanks for the replies

But can someone give me a sample code, how it should be done?
I looked code library but I didn't find any simple example to manage many operations in single button.

-Jussi
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