Pages: [1]   Go Down
Author Topic: Made software debounce looking for suggestions  (Read 266 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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>
Logged

St. Leonards-on-Sea, E. Sussex, UK.
Offline Offline
Sr. Member
****
Karma: 2
Posts: 301
Ancient developer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.eng.utah.edu/~cs5780/debouncing.pdf
Logged

Leon Heller
G1HSM

Pages: [1]   Go Up
Jump to: