- external interrupts need a good signal (5V 0V) to be triggered. A long wire can disrupt signal squarenes.- something about bouncing switches and interrupts might be useful ... (One IRQ?? I got 15!!)- enabling irq's within an ISR can give rise to reentry of the same ISR. Not trivial to handle though ... - length of irq's versus frequency ... (short flag setting IRQ's are preffered)
This is great, Nick. I have vainly looked in various Arduino books for this kind of info on interrupts. Thanks for putting it out there.I am interested in using the interrupts on "any pin" -- the PCINTx stuff; it would be good to get a little bit more on how to differentiate different interrupts on the same "port"; maybe an example or some other pointer to an example. I am concerned about the interaction with pins I am not using for interrupts; whether there are uses that cannot be combined with interrupt usage etc. Will I be triggering a PCINT2 ISR if I am using pin D4 for PWM output, and pins D5 and D6 for interrupts?
Great, that is the info I was missing. Nick, it would be great if you could add that stuff about the masking to your writeup.
I don't really have a problem ... (which is to say, I haven't tried it yet ...)
Good deal. All Things Are In The Datasheet XD
Some details I would add:Other reasons to use interrupts: - to wake up from sleep mode (you mention it but not so prominently).- super agressive performance optimization, not checking loop conditions but using timer interrupts to terminate loops thus allowing to optimize the check condition out of the code into the hardware
The interrupt event queues will hold at most 1 event per eventsource
The ones that set a flag could be regarded as being queued, as the interrupt flag remains set until such time as the interrupt routine is entered, at which time the processor clears the flag. Of course, since there is only one flag, if the same interrupt condition occurs again before the first one is processed, it won't be serviced twice.