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.

delay function for TMS570

Other Parts Discussed in Thread: TMS570LS20206

Hello,

I need to have a function to precisely introduce a delay of a certain amuont of time into my code.

I mean something similar to the DelayUs function for C2000 F28335 microcontroller.

Now I am using TMS570LS20206 microcontroller.

Is there something ready to use, like a libray function or similar?

Thanks in advance,

Elena

  • Elena,

    There is no library function for delaying in terms of time unit (us, sec, etc). You can build a delay function as follows

    void delay(unsigned int count)

    {

        register unsigned int i;

        for (i=0;i<count;i++);

    }

    Thanks and regards,

    Zhaohong

  • Hi Zhaohong,

    of course I know the use of the for loop. Sorry, maybe I haven't explained well my problem.

    I need a function that is able to introduce a PERFECTLY KNOWN time delay, in terms of number of clock cycles.

    That's the reason why I mentioned the _DSP28x_usDelay assembler function for C2000 family.

    Has somebody already developed a solution to this issue? If yes, please let me know...

    Thanks in advance,

    Elena

  • Any update on a delay function like this? I also would like a function that waits a specified amount of time:

    /* function waits for specified number of microseconds */

    void delay_us(int us)

    {

    }

  • Hi Jeffrey,

      A software delay loop in terms of absolute time will be subject to inaccuracy due to the program flow. For example, in the middle of a software delay loop you may have an interrupt. The wait states and the pipelining architecture on the flash from which you will run your code will also have impact on the absolute number of cycles to execute the loop. 

     You can refer to the below posts as suggestion for a delay loop function. 

    https://e2e.ti.com/support/microcontrollers/hercules/f/312/t/401145