time delay

hello is there any option for aduino like delayNanoseconds ?

what if I want a delay of 0.005 microseconds ? how can I introduce it ?

thanks

Delaying by anything less than a single clock cycle (62.5 ns at 16MHz or 0.0625us) is always going to be...problematic.

ok, what if I want 0.5 microseconds (500 ns) ?

Eight NOPs

sorry ?

dind't understood it, eight nops?

Yes, that's right. Eight of them. One will take 62.5ns, so eight will take 500ns.

ok but how can I write it? delayMicroseconds(0.5); arduino does not accept decimal numbers on the delay

Do eight simple instructions: byte x=x+1; x=x+1; x=x+1; x=x+1; x=x+1; x=x+1; x=x+1; x=x+1;

That's a fraction, not a factorial (!).

You need to use online assembler to use NOP.

http://www.nongnu.org/avr-libc/user-manual/inline_asm.html

Hello
I tried to put in the code delayMicroseconds(0);
and it doesn’t show any problems
does it mean that when I write delayMicroseconds(0); it assumes a delay of 62.5 ns ?

Thanks

does it mean that when I write delayMicroseconds(0); it assumes a delay of 62.5 ns ?

No, it means that several clock cycles were consumed determining that you didn't really mean to waste time doing nothing.

does it mean that when I write delayMicroseconds(0); it assumes a delay of 62.5 ns ?

No. Did you read the documentation for delayMicroseconds?

so it is not possible to output two different pins at the same time? (or almost the same)

CrossRoads: Do eight simple instructions: byte x=x+1; x=x+1; x=x+1; x=x+1; x=x+1; x=x+1; x=x+1; x=x+1;

Unless x is declared volatile, the compiler likely will combine the instructions into adding 8.

Any ideas as to why the value doesn't reset to three numbers?

Yes, it is. Search for PortManipulation to learn how.