5 calling a function block in st, 6 return instruction, 7 if instruction – Lenze DDS v2.3 User Manual
Page 44: Calling a function block in st, Return instruction, If instruction, Drive plc developer studio

Drive PLC Developer Studio
Programming languages
4-6
l
DDS EN 2.3
4.3.5
Calling a function block in ST
A function block in ST is called by using the name of the function block instance followed by
parentheses in which the parameters are assigned the required values.
Example
•
A timer is called with assignments for parameters IN and PT:
CMD_TMR(IN := %IX1.0.1, PT := T#300);
•
The result variable Q is then assigned to variable A:
A:=CMD_TMR.Q
•
As in IL, the result variable is addressed using the function block name followed by a period
and the variable name.
4.3.6
RETURN instruction
The RETURN instruction is used to complete the processing of the organization unit and to return to
the calling organization unit, depending on a condition, for instance.
4.3.7
IF instruction
Use the IF instruction to check a condition. Instructions can be executed depending on this
condition.
Syntax:
IF
{ELSIF
...
ELSIF
ELSE
END_IF
;
•
The part in curly brackets {} is optional.
•
If
executed.
•
Otherwise the Boolean expressions starting with
one after the other until one of the expressions returns TRUE. Then only the instructions after
this Boolean expression and before the next ELSE or ELSIF will be evaluated.
•
If none of the Boolean expressions is TRUE, only the
evaluated.
Show/Hide Bookmarks