Hi, I just started learning about interrupts on ATmega2560, but I have a problem I just can’t figure out. I have written a simple IRS that xor-s PORT B, just turning PIN 13 on and off on PIN 52 state change.
From what I understand the IRS should be called immediately(if there are no other interrupts running), turning the LED( PIN 13) OFF when i power PIN 52 and turning the LED ON when i disconnected PIN 52 from 5V.
And indeed when i power PIN 52 with 5V the LED turns off instantly,
BUT when i disconnect PIN 52 from 5V the interrupt happens with a delay of 2-4 seconds?!?
Also until interrupt on falling edge changes the LED(turns it back on) no other interrupt gets called(even though i am switching PIN 52 state), witch makes me think that the interrupt is actually called but something makes it take a long long time to complete?
I have taken a video that better shows what i tried to explain - - YouTube
My question is why is it taking so long to turn the LED back on? how can i fix it?
direct_port_control.ino (621 Bytes)