A function block is a POU that yields one or more values when executed.
The object is added to the application or the project by clicking “Project Add Object POU”. In the device tree or in the “POUs” view, function block POUs have the “(FB)” suffix.
It always calls a function block by means of an instance that is a copy of the function block.
The editor of a function block consists of the declaration part and the implementation part.
The values of the output variables and the internal variables remain unchanged after execution until the next execution. This means that the function block does not necessarily return the same output values for multiple calls with the same input variables.
In addition to the functionality described in IEC 61131-3, you can also use function blocks in CODESYS for the following functionalities of object-oriented programming:
-
⮫ Extension of a Function Block
-
⮫ Implementation of interfaces
-
⮫ Methods, ⮫ Methods, ⮫ Methods, ⮫ Methods, ⮫ Methods, ⮫ Methods, ⮫ Methods, ⮫ Methods
The top line of the declaration part contains the following declaration:
FUNCTION_BLOCK <access specifier> <function block> \| EXTENDS <function block> \|
IMPLEMENTS <comma-separated list of interfaces>
-
See also: ⮫ 'is_connected'
-
Calling a function block