Specifications

5-10
5.1 ST
5.1.5 Calling function blocks in ST language
5.1.5 Calling function blocks in ST language
The following description is used to call a function block in the ST language.
Enclose the assignment syntax that assigns variables to the input variable and output variable by
'( )' after the instance name.
When using multiple variables, delimit assignment syntax by ',' (comma).
The execution result of the function block is stored by assigning the output variable that is
specified by adding '.' (period) after the instance name to the variable.
1) Calling a function block with one input variable and one output variable
The following is the description to call the function block above.
2) Calling a function block with three input variables and two output variables
The following is the description to call the function block above.
Arguments using at function block call;
VAR_OUTPUT is not appeared on a template if a checkbox in the following option
window is not selected;
[Tools]
[Options] "Convert" "Structured Ladder/FBD/ST""Compile
Condition1"
"Allow VAR_OUTPUT at FB call (ST)".
Instance name(Input variable1:= Variable1, ... Output variable1: = Variable2, ...);
FB definition
FB Name: FBADD
FB instance name: FBADD1
Input variable1: IN1
Output variable1: OUT1
FBADD1(IN1:=Input1);
Output1:=FBADD1.OUT1;
FB definition
FB Name: FBADD
FB instance name: FBADD1
Input variable1: IN1
Input variable2: IN2
Input variable3: IN3
Output variable1: OUT1
Output variable2: OUT2
FBADD1(IN1:=Input1, IN2:=Input2, IN3:= Input3);
Output1:=FBADD1.OUT1;
Output2:=FBADD1.OUT2;