====== OSA : OS_Qtimer_Get ======
**_OST_QTIMER OS_Qtimer_Get (qtimer)**\\
=== ===
{{osa:ref:attr_call_not_int.png|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.
##[[en:osa:ref:appendix:configuration#Timer control|OS_ENABLE_QTIMERS]]## constant must be defined in ##[[en:osa:ref:appendix:configuration|OSAcfg.h]]##. Size of timers is set by ##[[en:osa:ref:appendix:configuration#Data types|OS_QTIMER_SIZE]]## constant
=== Call allowed: ===
Not in interrupt
=== Parameters: ===
{| class = "fpl"
|-
|//''qtimer''//
|Descriptor of timer. Variable of ##[[en:osa:ref:description:data_types#OST_QTIMER|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: ===
{| class = "fpl"
|-
|//''[[en:osa:ref:description:data_types#_OST_QTIMER|_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_Create|OS_Qtimer_Create]]
* [[en:osa:ref:allservices:OS_Qtimer_Delete|OS_Qtimer_Delete]]
* [[en:osa:ref:allservices:OS_Qtimer_Run|OS_Qtimer_Run]]
* [[en:osa:ref:allservices:OS_Qtimer_Break|OS_Qtimer_Break]]
* [[en:osa:ref:allservices:OS_Qtimer_Wait|OS_Qtimer_Wait]]
* [[en:osa:ref:allservices:OS_Qtimer_Delay|OS_Qtimer_Delay]]
* [[en:osa:ref:allservices:OS_Qtimer_Get|OS_Qtimer_Get]]
* [[en:osa:ref:allservices:OS_Qtimer_Check|OS_Qtimer_Check]]
* [[en:osa:ref:allservices:OS_Qtimer_IsRun|OS_Qtimer_IsRun]]
----
* [[en:osa:ref:services:alphabetical|Alphabetical]]
* [[en:osa:ref:services:brieflist|All services]]
~~UP~~