Time Jitter on AVR Interrupts

Post 32 of 38

Some instructions on the AVR take longer than others. This can prove to be a problem if you want interrupts to fire at exact times and you don’t want to sleep() all the time.

The solution is to stick some code in the interrupt that examines the timer and waits for a specific number of cycles to even it out to always take exactly the same amount of time.

Source: https://github.com/cnlohr/avrcraft/tree/master/terminal