Well I have tried one or two things and put in an order for some ATMega1284P's (+ a couple of 2560s) the reason being there seems far more support for these MCUs than the 644PA.
Anyways. after much poking and prodding around I eventually gave up on INT2 and added in PinChangeInt and to my surprise this was really easy and gave me back the other interrupts I could have lived without but were useful (originally this project was written for a 2560 MEGA and I really need it to go stand alone). So in case others need it; the bits I added to make it work are:
#define NO_PORTC_PINCHANGES // to indicate that port c will not be used for pin change interrupts
#define NO_PORTD_PINCHANGES // to indicate that port d will not be used for pin change interrupts
#include <PinChangeInt.h> // you need to download the repository and install in libraries folder
..........
const int selectPin = 2; //Joystick and Rotary encoder press button
.........
void setup()
{
.........
pinMode(selectPin, INPUT); digitalWrite(selectPin, HIGH);
PCintPort::attachInterrupt(selectPin, toggle, FALLING);
.........
}
void loop() { /*some code*/ }
void toggle() { /*ISR code*/ }
And that solved it.. Ok so maybe it's not the most elegant way but Jack sparked a thought in something he wrote and I had a light bulb moment as I sat with my first cup of coffee this morning.
I would still like to know how to get this working using attachInterrupt though - just for the sake of knowing ![]()
Thanks guys. It's great to have so many great engineers around to bark ideas at.
Steve