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.

1us delay function

Other Parts Discussed in Thread: TMS570LS0432

Hi.

I have being using TMS570LS0432.

and I would like to implement 1us delay function.

Following example does not want to.

void delay_us(uint16 time)

{

while(time--);

}

 

  • Best way is use RTI and code like this:

    {
    U32 waitTill = currentRTIvalue + wtime;
    while((I32)(currentRTIvalue - waitTill) < 0) // trick to compare over RTI overload
    { /* do nothing */ }
    }


    replace "currentRTIvalue" to used RTI counter

    Advantage: it not have problem with injected interrupt

    Disadvantage 1: you need program RTI to higher freqency than wait time inverted value

    Disadvantage 2: It is effective only for small delays (less then ~20-40us). For longer delays is better use RTOS and use this time for another task.