View previous topic :: View next topic |
Author |
Message |
sahu77
Joined: 08 Sep 2011 Posts: 202
|
Question about button() function |
Posted: Tue Feb 18, 2014 11:59 am |
|
|
Anybody can explain Code: | if(button(PIN_A0, 0, 50, 10, A0, 1)) |
? its sw function. _________________ sahu |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9177 Location: Greensville,Ontario
|
|
Posted: Tue Feb 18, 2014 12:19 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
sahu77
Joined: 08 Sep 2011 Posts: 202
|
|
Posted: Tue Feb 18, 2014 12:49 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Tue Feb 18, 2014 1:51 pm |
|
|
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
++++++++++++++++++++ |
|
![](templates/subSilver/images/spacer.gif) |
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Wed Feb 19, 2014 9:45 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|