This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C2000 Delay calulation using DELAY_US

Other Parts Discussed in Thread: CONTROLSUITE

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);
}

  • Hi Rohini,

    I'm not sure from where you found out DSP28x_usDelay() function. If your controlSuite is up to date, DELAY_US is the only function available for introducing delay. This is defined in DSP2833x_usDelay.asm file

    Regards,
    Gautam