Delay time accuracy of CyDelay()/CyDelayUs() with PSoC3 device

Question: Why there are so much error in using CyDelay() to generate fixed time delay?



The CyDelay functions - CyDelay(), CyDelayUs() implement simple software-based delay loops. The loops are designed to compensate for bus clock frequency and some other factors, but there are additional factors that may also influence the actual time spent in the loop. The delay time of each function can be calculated by counting up the assembly instruction implemention time.

In case of a more accurate delay time demanded, hardware(PWM, Timer) mode should be considered.