Debouce IRQ switch on M52233Demo

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Debouce IRQ switch on M52233Demo

2,232 次查看
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
标签 (1)
0 项奖励
回复
3 回复数

816 次查看
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 项奖励
回复

816 次查看
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 项奖励
回复

816 次查看
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 项奖励
回复