Debouce IRQ switch on M52233Demo

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Debouce IRQ switch on M52233Demo

1,731 Views
WOLF
Contributor I
What is the best way to debouce the switch on the demo board in software? does anyone have code that i can throw into the interrupt routine for this IRQ?
 
thanks
Labels (1)
0 Kudos
3 Replies

315 Views
WOLF
Contributor I
Thanks for your help everyone.  I will Try both a an RC delay for debouncing as well as try the delay of edge detection.
 
Thanks again.
0 Kudos

315 Views
RickN
Contributor I
Hi,
 
    You can put a small delay loop inside the IRQ before you clear the Edge Port Flag Bit in the Edge Port Flag Register.  This is not very elegant, but will get the job done. 
 
 
    Thanks,
 
     Rick
 
ISR ()
{
   volatile int idx;
 
   for (idx=0; idx<200; idx++)  // you will need to tune the exit condition, 200 is just a guess.
          ;   // spin
 
   do some work..
  
   clear the Edge Port Flag Bit for the specific ISRx
 
}
0 Kudos

315 Views
admin
Specialist II
Check the 52233 manual, if IRQ pin has Shmitt trigger. If yes, you can resolve the issure by pure hardware: insert integrating RC chain between the dry switch and the IRQ pin. For typical tiny relay with bounce time 5 ms, select Rohm*Cfarad=3*0.005s.
 
0 Kudos