4 string, 5 time data types, 2 defined data types – Lenze DDS v2.3 User Manual

Page 258: 1 array, String, Time data types, Array, Drive plc developer studio

Advertising
background image

Drive PLC Developer Studio

IEC 61131-3 Data types

10-2

l

DDS EN 2.3

10.1.4

String

A variable of type STRING can hold variable-length sequences of characters. The size specified for
memory reservation in the declaration is character-based and may be given in round or square
brackets. Where no value has been specified (1 to 255), the default is assumed as 20 characters.

Example of a 20-character string declaration:

str:STRING(20):=’This is a string’;

10.1.5

Time data types

The data types TIME, TIME_OF_DAY (in short TOD), DATE and DATE_AND_TIME (in short DT) are
processed internally like DWORD.

TIME

and TIME_OF_DAY specify time in milliseconds, with the count starting at TOD 00:00

o’clock.

DATE

and DT specify time in milliseconds, starting with the 1st of January 1970 at 00:00

o’clock.

In the time specification, h = hours, m = minutes, s = seconds and ms = milliseconds.

Example

TIME

#2h4m12s123ms

10.2

Defined data types:

10.2.1

Array

One, two, and three-dimensional arrays of elementary data types are supported. Arrays can be
defined in the declaration part of an organization unit or in a global variable list. Structures may also
form arrays.

Syntax:

<Field_name>:ARRAY [<ll1>..<ul1>,<ll2>..<ul2>] OF <elem. type>.

<ll1>, <ll2> specify the lower field range limit.

<ul1>, <ul2> specify the upper field range limit.

Limit values must be integers.

The following syntax is used to access components of arrays in the case of a two-dimensional field:

<Field_name>[Index1,Index2]

Example:

Declaration

Card game : ARRAY [1..13, 1..4] OF INT;

Implementation

Card game[9,2]

Show/Hide Bookmarks

Advertising