Closed rei-vilo closed 9 years ago
Interesting result - never thought about that in this detail. Having a quick look into the code i can see to issues:
Thank for the update on the 65536
limit, not 256
.
On Energia MT, the delay()
function yields but not the delayMicroseconds()
one, hence the importance of the later.
It is probably nearly impossible to have an "accurate" delayMicroseconds implementation that can delay at sub-1ms resolution while simultaneously letting it "yield". So having delayMicroseconds lock up the processor is a highly appropriate behavior IMO. I personally don't find delayMicroseconds all that useful.
1000 ppm is good enough. The importance is to avoid yielding, hence my interest on delayMicroseconds()
over delay()
.
Ah, gotcha.
delayMicroseconds() takes an unsigned int as argument and is 2 bytes hence the limit of 65,535.
I'm comparing three methods for a 1 s = 1000 ms = 1000000 μs delay:
delayMicroseconds(1000000L);
delay(1000);
wait_ms(1000);
defined asdelayMicroseconds()
seems to be bugged for the MSP430. For the MSP430F5529, I've experienced issues as I've detailed at #693.Why the
void delayMicroseconds(unsigned int us)
is limited to 65536 μs?Sketch