SCL Help says:
Timer functions are called like functions. The function identifier can therefore be used anywhere instead of an address in an expression as long as the type of the function result is compatible with the first replaced address.
The function value (return value) that is returned to the calling block is a time value of the data type S5TIME.
Absolute or Dynamic Call
In the call, you can enter an absolute value, (for example T_NO:=T10) of the TIMER data type as the number of the timer function. Such values can, however, no longer be modified during runtime.
Instead of the absolute number, you can also specify a variable or constant of the INT data type. The advantage of this method is that the call can be made dynamic by assigning the variable or constant a different number in each call.
To achieve a dynamic call, you can also specify a variable of the TIMER data type.
Examples
//Example of an absolute call:
CurrTime:=S_ODT (T_NO:=T10,
S:=TRUE,
TV:=T#1s,
R:=FALSE,
BI:=biVal,
Q:=actFlag);
//Example of a dynamic call: In each iteration of a
//FOR loop, a different timer function is called:
FUNCTION_BLOCK TIME
VAR_INPUT
MY_TIMER: ARRAY [1..4] of STRUCT
T_NO: INT;
TV : WORD;
END_STRUCT;
.
.
END_VAR
.
.
FOR I:= 1 TO 4 DO
CurrTime:= S_ODT(T_NO:=MY_TIMER.T_NO, S:=true, TV:= MY_TIMER.TV);
END_FOR;
//Example of a dynamic call using a variable of the
//TIMER data type:
FUNCTION_BLOCK TIMER
VAR_INPUT
mytimer:TIMER;
END_VAR
.
.
CurrTime:=S_ODT (T_NO:=mytimer,.....);