According to IEC 61131-3, program organization units or POUs are the language elements of a controller program. They are small, independent software units containing the program code. The name of a POU must be unique within the project.
In Machine Expert – Safety, two types of POUs are available: One program and a configured number of user-defined function blocks (FBs).
Each POU consists of a declaration part (local variables worksheet) containing the declarations of the local variables (used only within the POU) and a code part containing the instructions to be processed.
Information about opening and managing the different worksheets can be found in the topic "Project tree - overview".
Function blocks are POUs with multiple input/output parameters and internal memory. The value a function block returns depends on the value of its internal memory. Within a function block it is possible to call other function blocks or functions but not programs. Recursive calls are not allowed. The abbreviation for function blocks is FB.
Like IEC 61131-defined FBs and Safety Logic Controller-specific FBs (contained in a library), user-defined FB POUs are available in the Edit Wizard after editing, saving, and compiling the corresponding worksheets. This way, the call of a user-defined FB can be easily inserted into the code of the calling POU via drag & drop and declaring an instance name. Refer to the topic "Inserting function blocks using the Edit Wizard" for details.
Calling an FB in another POU is designated as instantiation.
A program POU usually contains a logical combination of function/function block calls. The behavior and use of programs are similar to function blocks. Programs have an internal memory. Programs cannot be called from other POUs. In Machine Expert – Safety only one program is allowed in a project. This program is automatically inserted while creating a new project. Its predefined name 'Main' cannot be modified and the program can neither be copied nor deleted.
According to IEC 61131 standard, a function is a POU with multiple input parameters and exactly one output parameter (return value). As functions do not have an internal memory, calling a function with the same values always returns the same result. In Machine Expert – Safety, some basic functions are provided in libraries. However, no user-defined function POUs can be created.