-

  • Function block instantiation

    The IEC 61131-3 standard defines function block instantiation. Instantiation means, a function block is defined once and can be used (instantiated) several times. This applies to all FBs (user-defined POUs as well as library FBs, such as IEC standard FBs, firmware FBs, user library FBs).

    Why instantiation?
    A function block has an internal memory where it stores its own processing data (local variables). As a consequence, the output values calculated by the FB depend on the internally stored values. The same input values applied to an FB instance do not necessarily deliver the same results in another FB instance.
    Therefore, it is necessary to store the internal data of the FB to a separated memory area each time the function block is processed, i.e., for each FB instance. To uniquely identify each FB instance and to clearly separate its memory area, instance names are used.
    The instance name of the function block has to be declared in the 'Variables' table of the POU where the FB is going to be used.

    The following applies:

    • Function blocks can be instantiated in other function blocks or in program POUs. Calling FBs in function POUs is not possible.
    • Functions are called without instantiation because they do not have an internal memory.