Call function blocks
The structured text programming language can call function blocks. Function block calls can be used in any expression, and contain properties explained in the following table.
Function block call properties
Property | Description |
---|---|
Name | Name of the function block instance. |
Meaning | Calls a function block from the standard library, or from a user-defined library, and accesses its return parameters. |
Syntax |
|
Operands | Parameters are expressions that match the type of the parameters specified for that function block. |
Return value | See syntax to get the return value. |
Function block call example

When setting the value of the return parameter in the body of a function block, you can assign the return parameter using its name concatenated with the function block name:
FunctionBlockName.OutputParaName := <expression>;
Example
(* ST program calling a function block *) (* declare the instance of the block in the variable editor: *) (* trigb1 : block R_TRIG - rising edge detection *) (* Function block activation from ST language *) trigb1 (b1); (* return parameters access *) If (trigb1.Q) Then nb_edge := nb_edge + 1; End_if;
Provide Feedback