__DELAY_MS, __DELAY_US, __DELAYWDT_US, __DELAYWDT_MS
__delay_ms(x) //request a delay in milliseconds
__delay_us(x) //request a delay in in microseconds
It is often more convenient to request a delay in time-based terms, rather than in cycle
counts. The macros __delay_ms(x) and __delay_us(x) are provided to meet this
need. These macros convert the time-based request into instruction cycles that can be
used with _delay(n). In order to achieve this, these macros require the prior defini-
tion of preprocessor symbol _XTAL_FREQ, which indicates the system frequency. This
symbol should equate to the oscillator frequency (in hertz) used by the system.
On PIC18 devices only, you can use the alternate WDT-form of these functions, which
uses the CLRWDT instruction as part of the delay code. See the _delaywdt function.
The macro argument must be a constant expression. An error will result if these macros
are used without defining the oscillator frequency symbol, the delay period requested
is too large, or the delay period is not a constant.