I used this opportunity to check the digital...Fast routines.
This here is around the limit
#define ledPin 13
Timer1.initialize(12); // called every 12 us
Timer1.attachInterrupt(callback);
pinMode(ledPin, OUTPUT);
int i;
int pWidth = 0;
void callback() {
digitalWriteFast(ledPin, HIGH); // set the LED on
i = pWidth;
while (i>0) --i;
pWidth +=4; //delay is 0, 4, 8, or 12 loops = 1.5, 3, 4.5, or 6us
if(pWidth>12) pWidth=0;
digitalWriteFast(ledPin, LOW);
}
This uses nearly half of the processor time. It was not possible to make much faster interrupts; around those 83kHz seems to be the limits.
Pulses generated are 1.5, 3, 4.5, and 6us long, a much better fine tuning is possible here; my delay code is a little bit clumsy...
Remember that the pins for digital...Fast have to be constants!!