Using all 4 interrupts and serial comm with MICRO

Hey all,

Long time listener, first time caller here. (hopefully this is the right location for my question, sorry if it isn't. admin feel free to move me)

I have a project with my MICRO that needs to control [speed and position of] 4 separate DC motors (each with mag-quad encoders, PID control) simultaneously. I'm pretty sure the only way to achieve this is to have an interrupt pin for each motor (I successfully did this with 2 motors and an UNO). I have done a bit of research and am still somewhat lost.

My question is this: Can I use all 4 interrupt pins on my MICRO and maintain serial communication functionality? I found that INT0 and INT1 are on the RX and TX pins, and I am not sure if i can just use them like normal, and everything should work fine, or do I possibly need to assign serial communication to different pins? If so, can it be a standard digital pin? Is there a better way to do this?

Thanks in advance, random Forum hero. You the real MVP!!

On a Arduino Micro (which uses native USB), the D0 and D1 pins have no relationship with the communication with the PC. So you can use them without problems for something else.

Depending on the rate of encoder pulses expected, you may not need to use interrupts at all. Paul Stoffregen's Encoder.h library will use interrupts when available but it doesn't have to if you're able to call the .read() method often enough. It also works adequately well when only one of the two pins on the encoder is connected to an interrupt pin.

Alternatively you can use pin change interrupts for the encoders to free the UART pins. Unlike the UNO the Micro doesn't allow pin change interrupts for all digital IOs but you might find a working setup. If not, post your schematics so we might be able to help.

Wow, thanks everyone!