advice needed for arduino as diesel injection brain...

I have been searching for some solution to replace the delay and found Arduino Playground - Timer1

Was thinking about the interrupt opening the injector and starting a timer, the timer does the closing so I suppose you where thinking the same.

shot in the dark:

attachInterrupt(18, Inject1, RISING);

void Inject1()
{
  // calculate how many uS 180 degrees last
  TimeFrame = (micros() - TimeOld);
  TimeOld = TimeFrame;
  // open injector1
  digitalWrite(inj1,HIGH);
  // start timer1
  Timer1.initialize(ThrottleDuration);
  Timer1.attachInterrupt(Close1);
}

void Close1()
{
  // close injector1
  digitalWrite(inj1, LOW);
}

Only I don't think I can share the timer between all 4 injectors but since I use the mega it seems I have 3 extra ones so 1,3,4 and 5 are all 16 bit.
From the docs timer0 is used for millis, micros, delay and PWM pin13 (my pump pressure output) so I won't touch it.

Does something like above work or am I ready for mental care? :wink: