8.2 void _delay_ms
void _delay_ms(double __ms)
The maximal possible delay is 262.14ms / F_CPU in MHz with the highest
resolution. When the user request delay which exceed the maximum possible one,
_delay_ms() provides a decreased
resolution functionality. In this mode _delay_ms() will work with a
resolution of 1/10ms, providing delays up to 6.5535 seconds (independent from the CPU
frequency). The user will not be informed about decreased resolution.
If the avr-gcc toolchain has __builtin_avr_delay_cycles() support, the maximal possible delay is 4294967.295ms/ F_CPU in MHz. For values greater than the maximal possible delay, overflows results in no delay i.e., 0ms.
Conversion of __ms into clock cycles may not always result
in an integer. By default, the clock cycles rounded up to next integer. This ensures
that the user gets at least __ms microseconds of delay.
Alternatively, by defining the macro __DELAY_ROUND_DOWN__,
or __DELAY_ROUND_CLOSEST__, before including this header file, the
algorithm can be made to round down, or round to closest integer, respectively.
_delay_ms() based on
__builtin_avr_delay_cycles() is not backward compatible with older implementations. In
order to get functionality backward compatible with previous versions, the macro
"__DELAY_BACKWARD_COMPATIBLE__" must be defined before including
this header file. Also, the backward compatible algorithm will be chosen if the code is
compiled in a freestanding environment (GCC option
-ffreestanding), as the math functions required for rounding are
not available to the compiler then.