Creating Extra Interrupt Pins on Mega 2560

I'm in need of 8 interrupt pins to read channels A & B of four motors and do not want to invest in the DUE (since any of it's pins can allegedly be used for interrupts), as there seems to still be a lot of confusion in using it since it's relatively new. Is there any way I can assign 2 more pins (aside from the predetermined 6 on the Mega)?

Thanks,
Jeff F.

Jeffro:
I'm in need of 8 interrupt pins to read channels A & B of four motors and do not want to invest in the DUE (since any of it's pins can allegedly be used for interrupts), as there seems to still be a lot of confusion in using it since it's relatively new. Is there any way I can assign 2 more pins (aside from the predetermined 6 on the Mega)?

Thanks,
Jeff F.

Yes, any digital input pin can be used to generate an interrupt via the pinchange interrupt mode. The arduino IDE doesn't support it directly but there is a library available to help use them easier.

http://playground.arduino.cc/Main/PinChangeInt

Basically every digital pin 'belongs' to one of the 8 bit PORTS and a pinchange interrupts tells the system that at least one of the pins of a port has changed. It's up to your code to then read the whole port and determine which bit(s) have changed from the last time you read the port. So it adds a little bit of overhead but you gain almost unlimited interrupt pins, especially on a mega board. :wink:

Lefty