5.4.7 How Can I Implement a Delay in My Code?

Using a device timer to generate a delay is the best method. If no time is available, then you can use the library functions _delay32, __delay_ms, or __delay_us, as they are described in the following document. It is available for download from the Microchip Technology website, www.microchip.com.

“16-Bit Language Tools Libraries Reference Manual” (DS50001456)