Using delay or delayMicroseconds inside an interrupt

Hi there! I am using an interrupt to trigger a SCR but it needs at least 1ms to reach the holding current so, I used delay(1) after the PORT command but, I got some instability after some minutes of operation, then I am asking for another way to get a delay inside the Interruption Service Routine... Any other suggestion?

The code of the ISR is the next one:

if(D==0.0){goto trigger;}
if(D>=65.0){goto endS;}
P=round(D*80.0);
delayMicroseconds(int(P));
trigger:
PORTE = PINE | B00001000; 
delay(1);
endS:
PORTE = PINE & B11110111;
triggerCounter++;

that's probably a bad idea to start with. an interrupt should not block the µController for 1ms

can't you just set a flag and capture that flag in the loop()?

I'm not a hardware guy but it's also possible to capture the pulse in specific hardware and have also in hardware something that will delay the transmission of the pulse by 1ms (look for "Monostable multivibrator")

Probably not even a great idea to do floating point arithmetic in an ISR.
It’s almost never a good idea to do gotos.

This is without goto’s, but there are still a few problems in it (using float, comparing float with a value, round to another float is not needed, int as parameter for delayMicroseconds, a delay in a ISR, and maybe more).

  if (D < 65.0)
  {
    if (D != 0.0)
    {
      P = round(D * 80.0);
      delayMicroseconds(int(P));
    }
    PORTE = PINE | 0b00001000;
    delay(1);
  }

  PORTE = PINE & 0b11110111;
  triggerCounter++;
PORTE = PINE | B00001000;

This will cause any "INPUT" pins on PORTE that are HIGH to become "INPUT_PULLUP" pins. If you want to set that one pin, use:

PORTE = PORTE | B00001000;

for which you can use the shortcut:

PORTE |= B00001000;