Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/19/04 17:20
Read: times


 
#74471 - RE: Push Button Bouncing Time Method
Responding to: ???'s previous message
A way to do this without interrupts:

<pre>


#define BUTTON_PRESSED (!debounce_ctr)
uint debounce_ctr = 1000;

if (!pushb) debounce_ctr = 1000; //reload if not pressed

if (debounce_ctr) debounce_ctr--; // count down if pressed

if (BUTTON_PRESSED) ..... so something if button is pressed

The value of 1000 here should depend on the cycle time of this program:
if this is 50 uS you get a debounce time of 50 mS.
Of course, a better way is to do the count down in a timer interrupt
routine, so the cycle time is not important anymore.

Lex.



List of 20 messages in thread
TopicAuthorDate
Push Button Bouncing Time Method            01/01/70 00:00      
   RE: Push Button Bouncing Time Method            01/01/70 00:00      
      RE: Push Button Bouncing Time Method            01/01/70 00:00      
      RE: Push Button Bouncing Time Method            01/01/70 00:00      
   RE: Push Button Bouncing Time Method            01/01/70 00:00      
      RE: Push Button Bouncing Time Method            01/01/70 00:00      
   RE: Push Button Bouncing Time Method            01/01/70 00:00      
   RE: Push Button Bouncing Time Method            01/01/70 00:00      
      RE: Push Button Bouncing Time Method            01/01/70 00:00      
         RE: Push Button Bouncing Time Method            01/01/70 00:00      
            RE: Push Button Bouncing Time Method            01/01/70 00:00      
   Hardware debouncing is also possible            01/01/70 00:00      
      RE: Hardware debouncing is also possible            01/01/70 00:00      
         RE: Hardware debouncing is also possible            01/01/70 00:00      
   RE: 4 points            01/01/70 00:00      
      Maddening Release - not always!            01/01/70 00:00      
         RE: Maddening Release - not always!            01/01/70 00:00      
            RE: Maddening Release - not always!            01/01/70 00:00      
            Release issue - Erik & Bartosz            01/01/70 00:00      
               As clear as a bell            01/01/70 00:00      

Back to Subject List