5.26 __sleep Intrinsic Function
The IAR __sleep
intrinsic function inserts a sleep
instruction.
Suggested Replacement
There is no equivalent MPLAB XC8 built-in function, but a sleep
instruction can be inserted using in-line assembly.
Use asm("sleep");
to insert the sleep
instruction
into the generated code.
Caveats
None
Examples
Consider migrating IAR code such
as:
void waitForService(void)
{
__enable_interrupt();
__sleep();
}
to
MPLAB XC8 code similar
to:void waitForService(void)
{
ei();
asm("sleep");
}
Further Information
See the In-line Assembly section in the MPLAB XC8 C Compiler User's Guide for AVR MCUs for more information on in-line assembly and this built-in function.