Go Down

Topic: Made software debounce looking for suggestions (Read 356 times) previous topic - next topic



I wrote a quick software debounce for my board. Was wondering how it looks? I can't really see how well/bad it works because my button is fairly solid (very little bounce that I can see) and I don't have a o-scope at my disposal. Anyway, below is my code for a push button connected in the INT0 external interrupt pin. Any suggestions would be greatly appreciated.

      pinRead = ( PIND &  (1<<PD2));
      for (i = 0; i<= 1000; i++){
         if  (pinRead == 0 && i == 1000){
            PORTB = 0x08;   
         else if (pinRead == 0x04 && i == 1000){
            PORTB = 0x00;


Leon Heller

Leon Heller

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131