AnsweredAssumed Answered

try to use _time_delay_until()

Question asked by Ulf Bormann on Nov 14, 2011
Latest reply on May 8, 2012 by Richard Rapier

Hi!

 

I found many examples that use the _time_delay() function but no one that uses the _time_delay_until function.

I have a task that should be executed every 2 ms. I don t want to use the _time_delay() function cause later I ve some more code between my Gpio_toggle and my _time_delay_until instructions which length of time is between 0.5 and 1.5 ms.

So I wrote the following code. If I exchange 

 _time_delay_until(pcTickCounter);

with _time_delay(2);

my GPIO toggles every 2 ms, but with the _time_delay_until instruction, the code waits and waits and waits until I stop execution.

 

Do you know what I made wrong?

 

void fast_com (uint_32initial_data)

{

MQX_TICK_STRUCT_PTR pcTickCounter;

 

 

pcTickCounter=_mem_alloc(sizeof(MQX_TICK_STRUCT_PTR));

 

_time_get_ticks(pcTickCounter);

 

 while(1){

   _time_add_msec_to_ticks(pcTickCounter,2);

    Gpio_toggle(PORTE, GPIO_PIN_ACCESS(28));

   _time_delay_until(pcTickCounter);

  }

}

Outcomes