Data Types

 

Data types determine what kind of value the variable can have. Data types define the initial value, range of possible values, and the number of bits.

To fulfill the requirements of the IEC 61508 standard and as an exten­sion to the IEC 61131 standard, safety-related and standard code is strictly distinguished in EcoStruxure Machine Expert - Safety. Therefore, also safety-related and standard variables, or more precise, safety-related and standard data types are distinguished.

Representation of safety-related and standard data types in the code

For easier distinction of standard and safety-related data types in code worksheets, they are represented different:

FBD/LD code: safety-related variables are displayed with a red back­ground. Variables of standard data types are shown without back­ground.VarDisplay_SE_Safe_NonSafe.png

ST code: safety-related variables are underlined in red, standard vari­ables are not underlined.

STcode_Safe_Standard_SE.png

IEC 61131-3 data types and safety-related data types

In EcoStruxure Machine Expert - Safety, the following IEC 61131-3 defined elementary data types and special safety-related data types are available:

IEC 61131-3 data types

Data type

Description

Size/Bit

Range

Default initial value

BOOL

Boolean

1

0...1

BOOL#0

INT

Integer

16

-32,768 up to 32,767

INT#0

DINT

Double Integer

32

-2,147,483,648 up to 2,147,483,647

DINT#0

TIME

Duration

32

0 up to 2,147,483,647ms

TIME#0ms

BYTE

Bit string of length 8

8

0...255(16#00...16#FF)

BYTE#0

WORD

Bit string of length 16

16

0...65,535(16#00...16#FFFF)

WORD#0

DWORD

DoubleWordBit string of length 32

32

0...4,294,967,295(16#00....16#FFFFFFFF)

DWORD#0

Safety-related data types

Data type

Description

Size/Bit

Range

Default initial value

SAFEBOOL

Safety-related Boolean

1

0...1

SAFEBOOL#0

SAFEINT

Safety-related Integer

16

-32,768 up to 32,767

SAFEINT#0

SAFEDINT

Safety-related Double Integer

32

-2,147,483,648 up to 2,147,483,647

SAFEDINT#0

SAFETIME

Safety-related duration

32

0 up to 2,147,483,647ms

SAFETIME#0ms

SAFEBYTE

Safety-related bit string of length 8

8

0...255(16#00...16#FF)

SAFEBYTE#0

SAFEWORD

Safety-related bit string of length 16

16

0...65,535(16#00...16#FFFF)

SAFEWORD#0

SAFEDWORD

Safety-related doubleWordBit string of length 32

32

0...4,294,967,295(16#00....16#FFFFFFFF)

SAFEDWORD#0

Generic data types

Generic data types are used to group elementary data types by forming a hierarchical structure. The generic data type ANY_SAFEBIT, for example, includes the elementary data types SAFEDWORD, SAFE­WORD, SAFEBYTE and SAFEBOOL. If a formal parameter can be connected to ANY_SAFEBIT, this means that variables of the data types SAFEDWORD, SAFEWORD, SAFEBYTE, and SAFEBOOL can be applied to it.

Structure of generic data types and safety-related generic data types supported by EcoStruxure Machine Expert - Safety

NOTE:

Generic data types which are not supported by EcoStruxure Machine Expert - Safety are not listed below (REAL and LREAL, for example). Also refer to your hardware docu­mentation for further restrictions concerning supported generic data types.

ANY_(SAFE)ELEMENTARY

   ANY_(SAFE)MAGNITUDE

       ANY_(SAFE)NUM

          ANY_(SAFE)INT

             (SAFE)INT, (SAFE)DINT

       ANY_(SAFE)BIT

          (SAFE)DWORD, (SAFE)WORD, (SAFE)BYTE, (SAFE)BOOL

       (SAFE)TIME