2 variables, 1 system variable, 3 addressing bits in variables – Lenze DDS v2.3 User Manual

Page 288: 4 identifiers, System variable, Addressing bits in variables, Identifiers, Drive plc developer studio

Advertising
background image

Drive PLC Developer Studio

IEC 61131-3 Operands

13-4

l

DDS EN 2.3

13.2

Variables

Variables are declared either locally in the declaration part of an organization unit or in the global
variable lists.

Variables can be used wherever where the declared type allows it.

The available variables can be called via the Help Manager.

13.2.1

System variable

System variables are implicitly declared variables that depend on the selected automation system
and were added to the automation system’s PLC configuration.

To find out the automation system’s system variable, select the command
Insert

Operand. In the dialog box Help Manager then select category System variable.

13.2.2

Access to variables of arrays, structures and organization units

Two-dimensional array components are accessed with the following syntax:

<Feldname>[Index1, Index2]

Variables of structures are accessed with the following syntax:

<Structure name>.<Variable name>

Variables of function blocks and programs are accessed with the following syntax:

<Organization unit name>.<Variable name>

13.2.3

Addressing bits in variables

Integer variables allow individual bits to be addressed. For this purpose, the variable is given an
index of the bit to be addressed. The bit index may be given through any constant. Indexing is
0-based.

a : INT;
b : BOOL;
...
a.2 := b;

The third bit of variable a is set to the value of variable b. The following error message is output if the
index is greater than the variable’s bit width:
Index ’<n>’ outside the range valid for variable ’<var>’!

The following variable types allow bit addressing.

SINT, INT, DINT, USINT, UINT, UDINT, BYTE, WORD, DWORD

The following error message is output if the variable type is not permitted.
Bit access must not be assigned to a VAR_IN_OUT variable!

13.2.4

Identifiers

An identifier is a sequence of letters, numbers and underscores starting with a letter or an
underscore.

Variable identifiers must not:

contain white spaces and umlauts,

be declared twice,

be identical to keywords.

Show/Hide Bookmarks

Advertising