For those who may not know it stands for "Read The F....... Manual"

The reality is that it's not realistic to read and remember every detail of any programming system.

I think I wasted two days because I didn't realize that delayMicroseconds() only works up to 16384 or 5.

I had a short sketch to repeatedly send a few characters followed by a short delay as test data for a sketch on a second Uno. The delay was/is critical to detecting a start bit. I must have tried every possible combination of options for my receiving program before it occurred to me to test what was actually being sent.

It works just as I thought it would two days ago now that I have replaced delayMicroseconds with delay (and a suitably altered number).

(and the new two line editor on this new website is a PITA)


(and the new two line editor on this new website is a PITA)

It really is, but see those two little lines in the bottom right corner of the text field?
You can drag that to make it bigger. Although you have to do it every time, so it's still a pain.

BTW, when posting this I got this Error, or whatever it is:

curl -X POST -d 'sender=forum&attr=Shpaget' 'http://sso.arduino.cc:45397/sso/askprobe' > /dev/null 2>&1 &

The "curl" error is a known problem which I have reported.

I suggest that if delays are critical you use a loop with checking micros() ... unless the delay happens to be inside an ISR.

And if the delay is inside an ISR then a lengthy delay is not recommended.

The delays aren't critical in the sense you mean. Using delay(milliseconds) works fine. The only purpose of that piece of code is to produce stuff that I can use to test code in a receiver routine.

The problem was that I incorrectly assumed I could have a delayMicroseconds() with a long delay (40 millisecs) and spent two days looking for a bug in my receiver code because delayMicroseconds was actually producing a negligible delay.

(By the way the editor box is a decent size today. But there is no sign of a resize thingy in Opera.)


Interesting. Since delayMicroseconds uses an unsigned int, I would have thought it would go to 32767 microseconds. The current docs for the function say that the longest accurate delay is 16383 microseconds. Is it just that it's innacruate above 16383? Have you tried doing a longer one?

Nick, while I agree that a long delay in an ISR is A Bad Idea, I see that the docs say "As of Arduino 0018, delayMicroseconds() no longer disables interrupts. "

This brings up another question. To what does 0018 refer? Clicking Help-About Arduino shows me that it is rev 1.5.2, but no mention of 0018, or 0022 (from another message).

(By the way the editor box is a decent size today. But there is no sign of a resize thingy in Opera.)

I'm also using Opera, and it's still there, you just have to look closer, a lot closer.

Actually, the reason it's limited to 16384 is that the delayMicroseconds() routine converts microseconds to loop counts and each loop takes 4 clock cycles which is 1/4 of a microsecond. So it shifts the parameter left twice. Anything bigger than 16383 overflows.


Thank you for your clever post with the picture of your own post being edited. What version of Opera are you using?

Mine is V12.01 and I certainly don't have a resize tab.


It's Version 12.16.