DirtyBits:
Agree that #define FRACT_INC ((MICROSECONDS_PER_TIMER0_OVERFLOW % 1000) >> 3) will result in integer for 16Mhz (or multiple of 8. ) and a fraction for 20Mhz, but is it possible to tweak this code so it can work with other frequencies too?
Tweak which code? The original code or the alternative I proposed?
i.e. If MCU is running at 20MHz it will take (1/20) micro Second for one cycle(or instruction), so if we just use 20 instructions like "nop" which takes one cycle to complete then we can create 1 micro Second delay.
That's a good way to approach delayMicroseconds but it doesn't help with millis.