duration of signal


All else being standard, how long will the output being set in this case:

  digitalWrite(CLK, LOW);
  digitalWrite(CLK, HIGH);
  digitalWrite(CLK, LOW);

I would think it would be at least one clock cycle, so 1/16MHz = 62,5ns, but is that so?

thanks for the help

From http://www.arduino.cc/playground/Learning/PortManipulation:

If you look at the source code in lib/targets/arduino/wiring.c, you will see that digitalRead() and digitalWrite() are each about a dozen or so lines of code, which get compiled into quite a few machine instructions. Each machine instruction requires one clock cycle at 16MHz, which can add up in time-sensitive applications. Direct port access can do the same job in a lot fewer clock cycles.

I suggest you take a look at the article for more information on the subject. But basically you will need to use the port registers if you want to achieve 1 instruction per cycle.