PCINT conflicts with encoder library

Aloha –

I got some errors on compile of a sketch containing a couple PCINTS on PORTA, and wheel encoder outputs on four pins of PORTC. I am using the PololuWheelEncoder library, and programming a 1284P-PU from the Arduino IDE. Digging into the library c++ file, and making the following changes, no compile errors:

/* renamed the PCINTn_vect
ISR(PCINT0_vect)
*/
ISR(PCINT2_vect)

, and…

/* commented out this block
ISR(PCINT1_vect,ISR_ALIASOF(PCINT0_vect));
ISR(PCINT2_vect,ISR_ALIASOF(PCINT0_vect));
#ifdef PCINT3_vect
ISR(PCINT3_vect,ISR_ALIASOF(PCINT0_vect));
#endif
*/

Reading the avr-libc manual, I think ALIASOF means no matter the PORT the four encoder lines are tied to, it is all referred back to the PCINT0_vect. Is that right? As I read the library file, it all seems to be based on use of a 328P MCU (except for the parts in re the Orang-SVP, which is beyond me). So is what I did legal? Can I expect any problems on my 1284P-PU that the compiler did not catch? I have still to work out coding the encoders for motion control, and am just chipping away a little bit at a time on this project.

Thank you for any feedback folks.
Mark

Hello, Mark.

I do not see any issues with what you are doing. If any of those interrupts are triggered, the code will run the ISR for the interrupt declared inside of ISR_ALIASOF().

- Jeremy