can anybody help me out in calculating the delay value. why do I get different values when I use DSP28x_usDelay and DELAY_US. Kindly help in understanding the calculation with an example.
1. I get a delay of 2 seconds when I use DELAY_US(2000000)
while(1)
{
GPIO_setLow(myGpio, GPIO_Number_0);
DSP28x_usDelay(2000000);
GPIO_setHigh(myGpio, GPIO_Number_0);
DSP28x_usDelay(2000000);
}
I used DELAY_US(2000000)
#define DELAY_US(A) DSP28x_usDelay(((((long double) A * 1000.0L) / (long double)CPU_RATE) - 9.0L) / 5.0L)
By calculating from above formula I get DSP28x_usDelay(23999518.2095998) which gives me 2 seconds delay
2. I get a delay of 162 milli seconds when I use DSP28x_usDelay(2000000)
while(1)
{
GPIO_setLow(myGpio, GPIO_Number_0);
DSP28x_usDelay(2000000);
GPIO_setHigh(myGpio, GPIO_Number_0);
DSP28x_usDelay(2000000);
}