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.

TMS320F28379D: Delay by pooling

Part Number: TMS320F28379D


Tool/software:

I have a program on a TMS320F28379D microcontroller.

My program structure is as follows:

void main(void)

{

Init_program(); // init clock, timer, hardware, peripheral, software variable.

delay_ms(5000);

start_flag = true;

while(1)

{

SW_Task_1(); // My application

}

}

My delay_ms() funtion is:

void delay_ms(uint32_t time_ms)
{
int16_t i;
while(time_ms--)
{
for(i = 0; i < 10000; i++);
}
}

Initially, I used CpuTimer0 and debug to measure, the execution time of the delay_ms(5000) function was approximately 4s.

But when I change the program to structure:

void main(void)

{

Init_program(); // init clock, timer, hardware, peripheral, software variable.

delay_ms(5000);

start_flag = true;

while(1)

{

SW_Task_1(); // My application 1

SW_Task_2(); // My application 2

}

}

This time, I measured the execution time of the delay_ms(5000) function to be about 4.7s.

I added a few SW_Tasks and the measured time changed, from 3.8 - 5.4s.

Please help me explain this phenomenon.

  • Part Number: TMS320F28379D

    Tool/software:

    I have a program on a TMS320F28379D microcontroller.

    My program structure is as follows:

    void main(void)

    {

         Init_program();   // init clock, timer, hardware, peripheral, software variable.

        delay_ms(5000);

        start_flag = true;

        while(1)

            {

                   SW_Task_1();   // My application

            }

    }

    My delay_ms() funtion is:

    void delay_ms(uint32_t time_ms)  
    {
      int16_t    i;
      while(time_ms--)
      {
        for(i = 0; i < 10000; i++);
      }
    }

    Initially, I used CpuTimer0 and debug to measure, the execution time of the delay_ms(5000) function was approximately 4s.

    But when I change the program to structure:

    void main(void)

    {

       Init_program(); // init clock, timer, hardware, peripheral, software variable.

       delay_ms(5000);

       start_flag = true;

       while(1)

       {

          SW_Task_1(); // My application 1

          SW_Task_2(); // My application 2

       }

    }  

    This time, I measured the execution time of the delay_ms(5000) function to be about 4.7s.

    I added a few SW_Tasks and the measured time changed, from 3.8 - 5.4s.

    Please help me explain this phenomenon.

  • Hi Lam,

    I apologize for the very late response. Do you still have this issue/question?

    Best Regards,

    Delaney