A builtin function that delays execution.
Include
<xc.h>
Prototype
void _delaywdt(unsigned long cycles);
Argument
cycles
Remarks
This is an inbuilt function that is expanded by the code generator. When called, this routine expands to an in-line assembly delay sequence. The sequence will consist of code that delays for the number of instruction cycles that is specified as the argument. The argument must be a constant expression.
The _delay()
builtin function can use loops and the
clrwdt
instruction to implement the delay.
An error will result if the requested delay is not a constant expression or is greater than 50,463,240 instructions. For even larger delays, call this function multiple times.
Example
#include <xc.h>
int main (void)
{
_delaywdt(10); // delay for 10 cycles
}