Illustration
This illustration shows some examples of DFB parameters

Description of the Parameters
This table shows the role of each parameter
Parameter |
Maximum number |
Role |
---|---|---|
Inputs |
32 (1) |
These parameters can be used to transfer the values of the application program to the internal program of the DFB. They are accessible in read-only by the DFB, but are not accessible by the application program. |
Outputs |
32 (2) |
These parameters can be used to transfer the values of the DFB to the application program. They are accessible for reading by the application program except for ARRAY-type parameters. |
Inputs/Outputs |
32 |
These parameters may be used to transfer data from the application program to the DFB, which can then modify it and return it to the application program. These parameters are not accessible by the application program. |
Legend:
(1) Number of inputs + Number of inputs/outputs less than or equal to 32
(2) Number of outputs + Number of inputs/outputs less than or equal to 32
Parameters that Can Be Accessed by the Application Program
The only parameters that can be accessed by the application program outside the call are output parameters. To make this possible, the following syntax must be used in the program: DFB_Name.Parameter_name
DFB_Name represents the name of the instance of the DFB used (maximum of 32 characters).
Parameter_Name represents the name of the output parameter (maximum 32 characters).
Example: Control.Accel
indicates the output Accel
of the DFB instance called Control
EN and ENO Parameters
EN is an input parameter, and ENO is an output parameter. They are both of BOOL type, and may or may not be used (optional) in the definition of a DFB type.
Where the user wishes to use these parameters, the editor sets them automatically: EN is the first input parameter and ENO the first output parameter.
Example of implementation of EN\ENO parameters.

If the EN input parameter of an instance is assigned the value 0 (FALSE), then:
the section(s) that make up the code of the DFB is/are not executed (this is managed by the system),
the ENO output parameter is set to 0 (FALSE) by the system.
If the EN input parameter of an instance is assigned the value 1 (TRUE), then:
the section(s) that make up the code of the DFB is/are executed (this is managed by the system),
the ENO output parameter is set to 1 (TRUE) by the system.
If an error is detected (for example a processing error) by the DFB instance, the user has the option of setting the ENO output parameter to 0 (FALSE). In this case:
either the output parameters are frozen in the state they were in during the previous process until the fault disappears,
or the user provides a function in the DFB code whereby the outputs are forced to the required state until the fault disappears.
VAR_IN_OUT Variable
Function blocks are often used to read a variable at an input (input
variables), to process it and to output the updated values of the
same variable (output variables). This special type of input/output
variable is also called a VAR_IN_OUT
variable.
The following special features are to be noted when using function
blocks/DFBs with VAR_IN_OUT
variables.
All
VAR_IN_OUT
inputs must be assigned a variable.VAR_IN_OUT
inputs may not have literals or constants assigned to them.VAR_IN_OUT
outputs may not have values assigned to them.VAR_IN_OUT
variables cannot be used outside the block call.
Calling a function block with a VAR_IN_OUT
variable in IL:
CAL MY_FBLOCK(IN1:=V1, IN2:=V2, IO1:=V3,
OUT1=>V4, OUT2=>V5)
Calling the same function block in FBD:

VAR_IN_OUT
variables cannot be used
outside the function block call.
The following function block calls are therefore invalid:
Invalid call, example 1:
|
Loading a |
|
Calling a function block with the The accumulator now contains
a reference to a |
|
AND operation on accumulator contents
and Error: The operation
cannot be performed since the |
Invalid call, example 2:
|
Loading a |
|
AND operation on accumulator contents
and a reference to a Error: The operation cannot be performed since the |
The following function block calls are always valid:
Valid call, example 1:
|
Calling a function block with the |
Valid call, example 2:
|
Loading a |
|
Assigning the accumulator contents
to the |
|
Calling the function block with
assignment of the actual parameter ( |