FFB Structure
(Original Document)
Structure
Each FFB is made up of an operation (name of the FFB), the operands are required for the operation (formal and actual parameters) and an instance name for elementary/derived function blocks.
Call of a function block in the FBD programming language:
CAUTION
UNEXPECTED APPLICATION BEHAVIOR
Do not call several times the same block instance within a PLC cycle
Failure to follow these instructions can result in injury or equipment damage.
Formal call of a function block in the ST programming language:
Operation
The operation determines which function is to be executed with the FFB, e.g. shift register, conversion operations.
Operand
The operand specifies what the operation is to be executed with. With FFBs, this consists of formal and actual parameters.
Formal/actual parameters
Inputs and outputs are required to transfer values to or from an FFB. These are called formal parameters.
Objects are linked to formal parameters; these objects contain the current process states. They are called actual parameters.
At program runtime, the values from the process are transferred to the FFB via the actual parameters and then output again after processing.
The data type of the actual parameters must match the data type of the input/output (formal parameters). The only exceptions are generic inputs/outputs whose data type is determined by the actual parameter. If the actual parameters consist of literals, a suitable data type is selected for the function block.
FFB Call in IL/ST
In text languages IL and ST, FFBs can be called in formal and in informal form. For detail, refer to chapter Programming Language.
Example of a formal function call:
out:=LIMIT (MN:=0, IN:=var1, MX:=5);
Example of an informal function call:
out:=LIMIT (0, var1, 5);
NOTE: The use of EN and ENO is only possible for formal calls.
VAR_IN_OUT variable
FFBs are often used to read a variable at an input (input variables), to process it and to output the altered values of the same variable (output variables).
This special type of input/output variable is also called a VAR_IN_OUT variable.
The input and output variable are linked in the graphic languages (FBD and LD) using a line showing that they belong together.
Function block with VAR_IN_OUT variable in FBD:
Function block with VAR_IN_OUT variable in ST:
MY_EXAMP1 (IN1:=Input1, IN2:=Input2, IO1:=Comb_IN_OUT,
           OUT1=>Output1, OUT2=>Output2); 
The following points must be considered when using FFBs with VAR_IN_OUT variables:
The following additional limitations apply to the graphic languages (FBD and LD):