3.4.7 How Can I Implement a Delay in My Code?
If an accurate delay is required, or if there are other tasks that can be performed during the delay, then using a timer to generate an interrupt is the best way to proceed.
Microchip does not recommend using a software delay on PIC32 devices as there are many variables that can affect timing such as the configuration of the L1 cache, prefetch cache, & Flash wait states. On PIC32 devices, you may choose to poll the core timer, which increments every two instruction cycles.