Safety POUs
POUs (Program Organization Units) are the programming objects of CODESYS Safety Extension which are declared as either programs (PROGRAM) or function blocks (FUNCTION_BLOCK).
The following POU types are available:
Safety Basic POU
POU in programming level Basic
Safety Extended POU
POU in programming level Extended
External POU (Safety)
For a more detailed description of the external POUs in CODESYS Safety Extension, see External POU – Editor.
Any number of POUs can be added to the project tree of the safety application.
Tip
For a better overview, you can create folders below the application in the project tree, and then add POUs and GVLs to these folders.
Program
A program cannot be called by other programs, but it can call function block instances.
Programs are called directly by the safety task. The programs that are called are defined in the Safety Task object. Only the called programs are executed on the controller.
Function block
Function blocks are always called by means of an instance, which is a copy of the function block that contains the data.
Each instance has an identifier (instance name) and a data structure which contains its input, output, and internal variables.
Function block instances can be called in function blocks.
As function blocks are declared and used like in CODESYS standard, they will not be described here any further.
Adding a POU
In the Devices view, select the SafetyApp safety application object.
In the context menu, click Add Object with the selection Basic POU (Safety) or Extended POU (Safety).
In the Add Basic POU (Safety) or Add Extended POU (Safety) dialog, type in the name and comment of the POU and select the POU type PROGRAM or FUNCTION_BLOCK.
In the case that the POU type is FUNCTION_BLOCK, the Usage check box can be enabled to Single call. For more information about using POUs with the Single call flag set, see Function block calls.
In the case of the POU type PROGRAM, the check box is automatically enabled for single calls and cannot be changed.
Click the Add button.
Commenting of POUs
According to PLCopen, the following information should be included in the Comment field for every POU:
Author
Date of creation of the POU
Release date
Version
Version history
Functional description (including I/O parameters)
Caution
In order for the new extended POU to be edited by authorized users only, the ExtendedLevel developer must revoke the Edit and Remove permissions of the extended POU for the Safety user group immediately after inserting the extended-POU. This is done in the Access Control tab of the properties dialog.
The editor of a POU consists of the Variable Declaration Editor and the Safety FBD Editor for implementing the program code.
Object properties of a POU
Every POU of a safety application has a properties dialog. This dialog is opened by selecting the corresponding POU in the project tree and activating the context menu command Properties. It contains the following tabs:
Common
Safety
Access Control
CRC of an object
Contrary to the pin CRC, the CRC for the individual objects of the safety application identifies the object contents together with the object version. The CRC is of importance if individual objects of a safety application are reused in another application.
Safety CRC
CRC of this POU
Version (editable)
The developer can freely assign the version. The version can be used for quickly detecting the object version in the Tab: Objects (object list) of the safety application object.
Comment (editable)
Usage
The Single call option
is automatically selected in the case of POU type PROGRAM. The setting cannot be changed.
can be selected in the case of POU type FUNCTION_BLOCK and can be enabled or disabled.
If this check box is not selected, then PLCopen function blocks cannot be used in the POU.
For more information about calling POUs with the Single call flag, see: Function block calls
For more information about the Common and Access Control tabs, see: Properties.