??? 10/11/05 01:05 Read: times |
#102207 - Using interrupts with switches Responding to: ???'s previous message |
I find it bad practice to use interrupts with switches - principly due to debounce and the possibility that you might get too many interrupts in quick succession due to EMI. However, if you need a keypress interrupt to wake the cpu up - that is acceptable as the interrupt is usually disabled after waking up. If you want to sample a switch, my usual method is to sample the switches on a regular basis - I normally have a timer tick at say 1mS or 10mS and have that code sample the switch inputs and debounce them. There's plenty written here and on the web about methods of switch debounce. Just a general note about interrupts - try to minimise the number of different interrupt sources you use where possible - this minimises the possibility of weird interactions. If you don't need interrupts for your ADC, then don't use them! |
Topic | Author | Date |
How to handle interrupts in this code | 01/01/70 00:00 | |
what about i? | 01/01/70 00:00 | |
handling interrupts. | 01/01/70 00:00 | |
the dangers of 'i' | 01/01/70 00:00 | |
debounce switch | 01/01/70 00:00 | |
errare humanum... | 01/01/70 00:00 | |
Using interrupts with switches![]() | 01/01/70 00:00 |