How long it is between the last statement in the loop() function and the first?

MorganS:
So about 16 instructions, then?

No, 17 cycles

LarryD:
Using an oscilloscope this time is time is ~1.0625uS

Are you excluding the time required by the PINB instructions :slight_smile:

And glad to see that my guess in Reply #6 was in the right ballpark.

...R

Yes I subtracted 'one' instruction time, 62.5nS from what I actually measured which was 1.125uS.

From the falling edge of the instruction at the end of loop() i.e. when the PINB has fully been executed, to rising edge of the instruction at the start of loop() i.e. when this PINB has been fully executed, so you have to subtract the 62.5nS for it, which I did.

.

It would be nice to have a more capable debugger:

mixed source code / disassembly
/ break/watchpoints
/ variable / register monitor
/ single step operation .... etc

as found in professional IDE's - eg the IAR or Keil offerings....

But the Arduino's IDE is not too bad for a freebie......

Allan