|
|
 | | From: | Mayank Kaushik | | Subject: | AT91RM9200: PIO: im getting two interrupts when i press the switch once :-( | | Date: | 10 Jan 2005 04:38:18 -0800 |
|
|
 | Hi,
im learning how to use the AT91RM9200..right now im trying to tackle the AIC. iv set everyhting up, earmarking PIOA0 for an external interrupt through a switch connected to it, so that theoretically whenever the switch is pressed, an interrupt is generated that sends a string via the debug port to hyperterminal.
everythings fine, but when i press the switch once, i get 2 interrupts...one whenthe switch is down, the other when i release it..ive tried this in all modes, level sensitive, edge sensitive, high level, positive edge, etc, all possible ones.. i dont suppose its due to a contact bounce, since im getting symmetric interrupts like this..im using the exact libraries provided by atmel (irq_pio.s and irq.mac)..
kindly advise what could be going wrong.. Thanx in anticipation
Mayank
|
|
 | | From: | Tauno Voipio | | Subject: | Re: AT91RM9200: PIO: im getting two interrupts when i press the switch | | Date: | Tue, 11 Jan 2005 09:41:49 GMT |
|
|
 | Mayank Kaushik wrote: > Hi, > > im learning how to use the AT91RM9200..right now im trying to tackle > the AIC. iv set everyhting up, earmarking PIOA0 for an external > interrupt through a switch connected to it, so that theoretically > whenever the switch is pressed, an interrupt is generated that sends a > string via the debug port to hyperterminal. > > everythings fine, but when i press the switch once, i get 2 > interrupts...one whenthe switch is down, the other when i release > it..ive tried this in all modes, level sensitive, edge sensitive, high > level, positive edge, etc, all possible ones.. > i dont suppose its due to a contact bounce, since im getting symmetric > interrupts like this..im using the exact libraries provided by atmel > (irq_pio.s and irq.mac).. >
The culprit may be the mechanical switch. It sends numerous contact/no contact cycles when the contacts are just touching. This is called contact bounce. Have a look at the voltage on the live switch contact with an oscilloscope.
The classical method is to use a switch with both a normally open and a normally closed contact. The contacts are used to set and reset a simple flip-flop which changes state at the first touch of a bounce and ignores the rest of the bounces.
Another method is to force your program to ignore the bounces with a timer.
It is not a good idea to feed an unprocessed switch contact to an interrupt input.
HTH
--
Tauno Voipio tauno voipio (at) iki fi
|
|
 | | From: | Mayank Kaushik | | Subject: | Re: AT91RM9200: PIO: im getting two interrupts when i press the switch once :-( | | Date: | 11 Jan 2005 01:56:56 -0800 |
|
|
 | it wasnt the contact..the pio in this controller can only trigger on input changes, nothing else..soree for the bother :-s but thanx for the debounce info, might come in handy later
|
|
|