Available Languages?:

OSA : OS_Dtimer_Get

_OST_DTIMER OS_Dtimer_Get (dtimer)

Get dynamic timer's remaining time. Before calling this service you should do one of these things:

  • disable interrupts
  • enter critical section
  • stop timer with OS_Dtimer_Stop service

Otherwise the timer's value can be changed in an interrupt while reading.

OS_ENABLE_DTIMERS constant must be defined in OSAcfg.h. Size of dynamic timers is set by OS_DTIMER_SIZE constant

Call allowed:

Everywhere

Parameters:

dtimer Descriptor of dynamic timer. Variable of OST_DTIMER type. Contains timer counter, timer state flags and pointer to next timer in list. For PIC16, can only be allocated in bank0 or bank1

Returns:

_OST_DTIMER integer value of remaining time (in system ticks)

Example:

OST_DTIMER dtimer;
 
void Task (void)
{
    for (;;) {
        /*...*/
        OS_Dtimer_Pause(dtimer);
        if (OS_Dtimer_Get(dtimer) < 10)  // Flash green led if less
            GREEN_LED = 1;               // than ten ticks remain
        OS_Dtimer_Continue(dtimer);
        /*...*/
    }
}

Old style name

OS_GetDTimer

See also

 
en/osa/ref/allservices/os_dtimer_get.txt · Last modified: 07.10.2010 13:56 (external edit)
 
Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki