user52793: 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.

user10794: It's not that pins 18 or 19 are faulty, you are just lucky the other ones worked.
As I mention on my page about interrupts* you are recommended to always write 1 to the appropriate EIFR bit before enabling interrupts because it (the interrupt condition) may have been set in the past.
I checked the source for attachInterrupt in the file WInterrupts.c and there is no mention of the EIFR register, therefore attachInterrupt never affects that register.

* Also see my answer: How do interrupts work on the Arduino Uno and similar boards?

52793: <p>Experimenting with external interrupts on a Mega. Pins 2 and 3 work with standard</p>

<p><code>attachInterrupt(digitalPinToInterrupt(iPin),ISR,FALLING);</code> </p>

<p>coding and call my ISR. With pins 18 and 19 I had to add</p>

<pre><code>EIFR = 4;
</code></pre>

<p>for pin 19, and </p>

<pre><code>EIFR = 8;
</code></pre>

<p>for pin 18 before calling attachInterrupt(...) to get them to work. Why?</p>

<p>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)</p>

<pre><code>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
</code></pre>

<p>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.</p>
 10794: <p>It's not that pins 18 or 19 are faulty, you are just lucky the other ones worked.</p>

<p>As I mention on <a href="http://www.gammon.com.au/interrupts" rel="nofollow noreferrer">my page about interrupts</a>* you are recommended to always write 1 to the appropriate EIFR bit before enabling interrupts because it (the interrupt condition) may have been set in the past.</p>

<p>I checked the source for <code>attachInterrupt</code> in the file WInterrupts.c and there is no mention of the EIFR register, therefore <code>attachInterrupt</code> never affects that register.</p>

<hr>

<p>* Also see my answer: <a href="https://arduino.stackexchange.com/questions/30968/how-do-interrupts-work-on-the-arduino-uno-and-similar-boards/30969#30969">How do interrupts work on the Arduino Uno and similar boards?</a></p>
