How to calculate loop delay in AVR?
The basic principle of time delay is to create a loop so that the microcontroller waits for a certain period of time without processing. The duration of a command is equal to the cycle time of the oscillator used. The duration of a command in an AVR using an f Mhz oscillator; T = 1 / f * 10 ^ 6 seconds.