Define Parameters and Private Variables

For a FunctionClosed A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. or UDFBClosed "User Defined Function Block" UDFB can be used as a sub-function block in another program of the application. It is described using FBD, LD, ST or IL language. Input / output parameters of a UDFB (as well as private variables) are declared in the variable editor as local variables of the UDFB, input and output parameters (as well as private variables) are declared in the Dictionary toolbox as local variables of the item. The Add variable command let you add the following:

Parameters and Private Variables

Figure 4-97: Parameters and Private Variables

Input and Output parameters always appear at the beginning of a UDFB group.

Pressing the INSERT key when the item is selected adds a private variable.


  • There are some things to be aware of with UDFB parameters:

    • UDFB cannot contain parameters being both for Input and Output
    • Simple parameters (scalar type) can be either IN, OUT, or IN_OUT
    • Complex parameters (an array or structure) should be declared as IN but is systemically considered to be IN_OUT.
    • UDFB cannot have more than 32 input parameters or 32 output parameters
    • Output parameters can only be simple data type