Electronic – arduino – Good solution for more interrupts on an arduino

arduinoexpanderinterrupts

I'm building a circuit with an Arduino Mega and simple IC chips (e.g. 7432) but I have many lines to monitor for interrupt conditions and not enough pins on the Atmel so I'm looking for a way to expand this. Problems ensue because I need to be able to switch the trigger condition from rising edge to falling edge for some lines based on conditions, and some lines will remain high after having been serviced, so a priority encoder would suffer from the condition that a higher priority interrupt would mask a lower priority one. For the latter problem, I am thinking of using a register and some gates to allow disabling of some interrupts, but I don't have a good solution for the former. Does anyone have any suggestions? I'm getting new chips as needed, so solutions involving extra 7400 series ICs or similar would be appreciated, but something more exotic would be OK as well.

Best Answer

An Arduino Mega has “only” 24 pin change interrupts for its 80 pins. Still, that may be enough for the original poster, and he may not have been aware of this possibility, because the “INT" pins have API support in the Arduino environment, while the pin change interrupts don’t.

Here’s some fairly elaborate code to attach to pin change interrupts