Data types
In CODESYS Safety Extension, a distinction is made between non-safety-oriented data (the IEC standard data types) and safety-oriented data (with the prefix SAFE
). When mapping input and output channels, those of safe field devices always have the type SAFExxx
and those of non-safe field devices always have a non-SAFE
type. The checking of the PLCopen linking rules for SAFEBOOL
data and analogous linking rules for the other SAFEXXX
data types is part of the check for error conditions in the programming system.
Data Type | Bit Length | Value Range | Description |
---|---|---|---|
|
|
|
|
|
|
| |
|
|
| |
|
|
| Duration |
|
|
( |
Tip
The BYTE
, DWORD
, SAFEBYTE
, and SAFEDWORD
data types can appear only in the logical I/Os and can be used in Extended level programs as channel variables (category: global variables, declaration as VAR_EXTERNAL
).
Data Type | Bit Length | Value Range | Description |
---|---|---|---|
|
|
|
|
|
|
| |
|
|
| |
|
|
| |
|
|
( |
Tip
The REAL
data type is not permissible in Safety programming. If it is nevertheless used, this causes a translation error.
User-defined data types
The User-defined Types data type category contains function blocks of the safety application and the libraries. This category can be selected in the Input Assistant, which is opened in the Insert Variable Declaration dialog by clicking the button. In the case of already declared variables the Input Assistant of the data type is opened as follows:
In the declaration window, select the type cell of the corresponding variable.
In the list box, click the ... symbol.

General rules for typification
INT polymorphism
A value of the type INT
or SAFEINT
always has the type DINT
or SAFEDINT
as well. The linkage of INT
and DINT
leads to a DINT
value (int
+ dint
has the type DINT
).
SAFE polymorphism
A value of the type SAFEXXX
always has the type XXX
as well; i.e. a value of high integrity can always also be used as a value of low integrity. This means that the conversion function SAFEBOOL_TO_BOOL
mentioned in PLCopen is implicit in CODESYS Safety Extension and is not explicitly written.
SAFE constants
Constants are always values of the highest integrity (i.e. SAFEXXX
). Due to the SAFE
polymorphism they can still serve as normal values. One thus saves having two different kinds of values (safebool#1
as well as bool#1
).bool#1
is SAFEBOOL
(and BOOL
); the same applies to the other literal constants.
SAFE downgrade
The general rule for linking values is as follows: if and only if all operands have a SAFE
type, then the result has a SAFE
type.
Exception: SAFEBOOL
AND
BOOL have the value SAFEBOOL
.