5 data types, General language elements – Lenze DDS v2.0 User Manual

Page 12

Advertising
background image

Introduction to IEC 61131-3 programming

General language elements

10

l

DDS-IEC61131 EN 2.0

Integers can be defined with a basis, decimal numbers can also have a sign (+ or -). Reals can also
be indicated with exponents.

Identification

Example

Integers
decimal

10

binary

2#

2#1010

octal

8#

8#12

hexadecimal

16#

16#A

Reals
without exponent

-12.50

with exponent

E

15.7E4

Times

There are two different time literals: Duration and time of day/date.

Identification

Example

Duration

T# or TIME#

T#10ms

Time of day/date
Date

D# or #DATE

D#1999-08-29

Time of day

TOD# or #TIME_OF_DAY

TOD#15:36:30

Date and time of day

DT# or #DATE_AND_TIME

DT#1999-08-29-15:36:30

4.5

Data types

IEC 61131-3 defines different standard data types. They help to compile derived and user-defined
data types. Each identifier is assigned to a data type. The type determines how much memory is
to be reserved and which values correspond to the memory contents.

Standard data types

BOOL

(truth values TRUE/FALSE)

BYTE

, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT (integer data types)

REAL

(floating point data type)

STRING

(character string)

TIME

, TIME_OF_DAY, DATE, DATE_AND_TIME (time data types)

Defined data types:

ARRAY

(one, two, three-dimensional field)

POINTER

(contains addresses of variables/function blocks for the run-time of the program)

Enumeration (

enumerated, consists of many string constants)

STRUCT

(structure)

Reference (generates an alternative name for a variable/constant/function block)

Show/Hide Bookmarks

Advertising