Long delay before pin change(HIGH to LOW) interrupt call? Why?

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)

OP’s code.

// the setup function runs once when you press reset or power the board
void setup() {

  //PINs setup
  DDRB |= B10000000; //sets PIN 13( PORT B 7.Bit ) as output
  PORTB = B10000000; //sets Pin as HIGH
  

  //Interupt Setup
  PCICR |= (1 << PCIE0); // set PIN_CHANGE_INTERRUPT_CONTROL_REGISTESs bit 0(PCIE0), cloud be just B00000001 //PCIE0 corresponds to PCMSK0 
  PCMSK0 |= (1 << PCINT1); //enable interupt on PIN 52;
  
}

//Interrup SubRoutine
ISR(PCINT0_vect){

  //cli(); tried, still doesn't work
  
  PORTB ^= B10000000; //turn the LED on or off

  //sei(); tried, still doesn't work
  
}

void loop() {
}

BUT when i disconnect PIN 52 from 5V the interrupt happens with a delay of 2-4 seconds?!?

Disconnect? Do you connect it to ground? Or do you leave it floating and possibly reading HIGH still for a while?

Oh Thank you, i left it floating.. :( if i connect it to ground it works, i feel so silly