I wanted to build a stopwatch using millis(), I'm wondering whats the error on this function. If the error just depends on the crystal (usually +-10ppm) then it would be 0.01s over 1000s which is very small of course. But I'm pretty sure the error is bigger right?
In every reading of the millisCounter using millis() function, you risk to loose 1 ms time as the millisCounter is updated by 1 ms tick on interupt basis in the background. If you are driving an 1-sec procision stop watch, the error would 1 ms in 1-sec.
Be aware that on the UNO/Nano, with a 16MHz oscillator, the millis() function will occasionally skip a count (increment by 2 instead of 1) because of the limitations of using an 8-bit counter for the millis interrupt. The link in reply #2 details that this results in a progressive deviation from the true 1mS interval until the correction is made by skipping the count.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.