Available Languages?:

OSA : OS_Qtimer_Get

_OST_QTIMER OS_Qtimer_Get (qtimer)

Not allowed in interrupt

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

  • disable interrupts
  • enter critical section

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

OS_ENABLE_QTIMERS constant must be defined in OSAcfg.h. Size of timers is set by OS_QTIMER_SIZE constant

Call allowed:

Not in interrupt

Parameters:

qtimer Descriptor of timer. Variable of OST_QTIMER 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_QTIMER integer value of remaining time (in system ticks)

Example:

OST_QTIMER qtimer;
 
void Task (void)
{
    char itemp;
    for (;;) {
        /*...*/
        itemp = OS_DI();
        if (OS_Qtimer_Get(qtimer) < 10)   // Flash green led if less than
            GREEN_LED = 1;                // ten ticks remain
        OS_RI(itemp);
        /*...*/
    }
}

See also

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