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

Question about button() function

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



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

Question about button() function
PostPosted: Tue Feb 18, 2014 11:59 am     Reply with quote

Anybody can explain
Code:
 if(button(PIN_A0, 0, 50, 10, A0, 1))

? its sw function.
_________________
sahu
temtronic



Joined: 01 Jul 2010
Posts: 9134
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Feb 18, 2014 12:19 pm     Reply with quote

Easy ! goto -> http://www.ccsinfo.com/forum/viewtopic.php?t=23837

PCMProgrammer's 'button' function. EVERYTHING you need to know about it is carefully commented. It's his version of the PBP 'button' function.

hth
jay
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Tue Feb 18, 2014 12:49 pm     Reply with quote

thank you dear temtronic,
i have need 1 simple code for push on switch.
1) push switch till 500 ms
2) count =1
3) ofter 2 sec again push switch till 500 ms
4) count =2
.
.
.
..
count =8
if( count >=8)
count ==0
pl help me
_________________
sahu
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue Feb 18, 2014 1:51 pm     Reply with quote

Sahu,

Please don't hijack ZombiePIC's thread!! Start your own thread with your switch question! Don't confuse things more than they already are by posting it here!!

John


++++++++++++++++++++
Split into new thread per request.

- Forum Moderator
++++++++++++++++++++
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Wed Feb 19, 2014 9:45 am     Reply with quote

Hi Sahu,

What is the significance of the 500mS 'On' time, and the 2 second 'Off' time? No intelligently designed User Interface is going to have those constraints 'just because'...... If you use PCM Programmers 'button' function, it will take care of the switch debounce for you, so all you need to do is add the counting code with terminal reset at a count of 8. Should be very easy!

What am I missing?

John
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