Experimenting with external interrupts on a Mega. Pins 2 and 3 work with standard
attachInterrupt(digitalPinToInterrupt(iPin),ISR,FALLING);
coding and call my ISR. With pins 18 and 19 I had to add
EIFR = 4;
for pin 19, and
EIFR = 8;
for pin 18 before calling attachInterrupt(...) to get them to work. Why?
BTW, I'll add this table that I filled in by trial and error for anyone interested in Atmel (AVR) external interrupt numbers to Arduino external interrupt numbers (I won't list the AVR chip pin numbers)
AVR INT 5 . 4 . 3 . 2 . 1 . 0
EIFR (Dec) 32 . 16 . 8 . 4 . 2 . 1
Arduino Pin 3 . 2 . 18 . 19 . 20 . 21
Arduino INT 1 . 0 . 5 . 4 . 3 . 2
I know writing a 1 to the EIFR bit for the appropriate interrupt clears the interrupt. When I reset the Arduino without clearing interrupts on pins 2 and 3 it's fine. If I don't clear 18 and 19 after a reset, it throws the interrupt right away. (Yes, I should OR the EIFR with the bit I want to change but I'm just playing) Didn't try 20 and 21 because I'm using them for comm.