Arduino Timer0 Interrupt Problems
by avandalen in Circuits > Arduino
45 Views, 0 Favorites, 0 Comments
Arduino Timer0 Interrupt Problems

The Arduino built-in timer0 interrupt may cause hard-to-find bugs
This article covers a lesser-known Arduino issue: Arduino programs are interrupted every 1.024 ms by an Interrupt Service Routine (ISR) running in the background. Most sketches do not suffer from this interrupt, but in time-critical applications, where small accurate time intervals are needed (1-100 µs) the interrupt has to be be disabled.
Supplies

You can clearly observe the influence of the timer0 interrupt in this example of a 2 MHz square wave, generated with the Arduino Nano. The 2 MHz square wave is interrupted every 1.024 ms for a duration of 6 µs.

Here I am working with electronics that operate with precise intervals ranging from 20 to 100 microseconds.
See for the full article: https://avdweb.nl/arduino/timing/timer0-interrupt