AVR Libc Home Page | AVR Libc Development Pages | ||||
Main Page | User Manual | Library Reference | FAQ | Alphabetical Index | Example Projects |
Functions | |
void | _delay_us (double __us) |
void | _delay_ms (double __ms) |
#define F_CPU 1000000UL // 1 MHz //#define F_CPU 14.7456E6 #include <util/delay.h>
#define
statement should be used.
void _delay_ms | ( | double | __ms | ) |
Perform a delay of __ms
milliseconds, using _delay_loop_2().
The macro F_CPU is supposed to be defined to a constant defining the CPU clock frequency (in Hertz).
The maximal possible delay is 262.14 ms / F_CPU in MHz.
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/10 ms, providing delays up to 6.5535 seconds (independent from CPU frequency). The user will not be informed about decreased resolution.
void _delay_us | ( | double | __us | ) |
Perform a delay of __us
microseconds, using _delay_loop_1().
The macro F_CPU is supposed to be defined to a constant defining the CPU clock frequency (in Hertz).
The maximal possible delay is 768 us / F_CPU in MHz.
If the user requests a delay greater than the maximal possible one, _delay_us() will automatically call _delay_ms() instead. The user will not be informed about this case.