User-Defined Function Blocks
The list of programs is completed with "User-Defined Function Blocks" (UDFBs). UDFBs are described using , FBD, FFLD, ST or IL languages, and can be used as other function blocks in the programs of the application. Input and output parameters plus private variables of a UDFB are declared in the variable editor as local variables of the UDFB.
There is no restriction using any operation in a UDFB. A UDFB can call standard functions and function blocks.
A UDFB can call another UDFB. Note that the called UDFB must be declared before the calling one in the program list.
Each time a UDFB is instantiated, its private variables are duplicated for the declared instance. The code of the UDFB is duplicated on each call in parent programs. This leads to higher performances at run-time, but consumes code space. It is recommended to package small algorithms in UDFBs. Large parts of code must be managed in programs.