Go Down

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

ack47

Hello,

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.

<code>
ISR(INT0_vect){
      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;
         }
      }   
}

</code>

Leon Heller

http://www.eng.utah.edu/~cs5780/debouncing.pdf
Leon Heller
G1HSM

Go Up