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.

CCS/TMS320F28035: TMS320F28035

Part Number: TMS320F28035
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

Hi, 

How can make or call a delay function in seconds? Is there a library for sleep_time in code composer I can call?

  • Karzan,

    You can either use predefined delay functions available in .h file such as: delay_ms() or delay_us() (so for one second delay you can use delay_ms(1000) or delay_us(1000000)) or  make your delay function and call it wherever in your code:

    void delay_loop(void);

    /

    /

    /

    /

    void delay_loop()

    {

       short i;

       for (i = 0; i < DELAY; i++) {}

    }

    Then you need to define the value of "DELAY" based on the desired delay time and the clock speed of your CPU.

    --Kash

    If my post answers your question, please click on"Verified Answer" button.

  • Thought I'd add that in controlSUITE under the F2803x\common\include there's a DSP2803x_Example.h file that has a macro DELAY_US that will allow you to specify a number of microseconds you want to delay. There's a CPU_RATE macro in the same file that allows you to adjust for different system clock rates.

    Whitney