User guide

49
VTB USER GUIDE
11.2 MISCELLANEOUS API FUNCTIONS
GET_TIMER
Reads the system timer in units of TASK PLC (scan time).
Hardware All
Syntax
Long GET_TIMER ()
Return value:
Value of the system timer in sampling units
Some defines are automatically generated by VTB to adapt the application at the scan time:
TAU Scan time of TASK PLC in milliseconds (INTEGER value)
TAUFLOAT Scan time of TASK PLC in milliseconds (FLOAT value)
TAUMICRO Scan time of TASK PLC in 0.1 milliseconds
Example
Used variables:
Tick long
Tick=Get_timer() Get initial value of timer
while Test_timer(Tick,1000/TAU) Waiting for 1 second
Loop
PAGINA
Sets the page to be loaded and displayed. Pages are numbered starting from 1. The new page will be loaded not
immediately but at the next cycle of the cooperative task.
Hardware All
Syntax
PAGINA (int Page)
Parameters
Page Number of the page to be loaded
TEST_TIMER
Compares the system timer with a value. It is used together the function get_timer to make timing.
Hardware All
Syntax
char TEST_TIMER (long Timer, long Time)
Parameters
Timer Initial value of system timer
Time Time to compare
Return value:
1= time elapsed
0=time not elapsed
Example
Used variables:
Tick long
Tick=Get_timer() Get initial value of timer
while Test_timer(Tick,1000/TAU) Waiting for 1 second
Loop