I got this one from Olivier
When writing a timer routine it is often very difficult to get accuracy. If timing correction is attempted at the lowest level in say the OSC freq selection or the interrupt routine reload value, even though the error may be very small it can accumulate over time to become quite large. A 1 us error every 100hz will add up to 8.64 seconds per day.
A way to reduce those errors is to time the code over a reasonable period i.e. 24 hours. Then at the appropriate section in the routine, you can compensate for the measured error by adding or subtracting in the necessary correction factor.
Even crude loop counters can be made pretty accurate over extended periods.
contributed by Timothy Box.


Menu
Recent Articles


Using PDS with SPI GLCD based on ST7565R Controller
Graphic LCDs based on the ST7565 are cheaper then GLCDs with other controllers. SPI requires only four pins. If the circuit