Variables, System flags, L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual

Page 511

Advertising
background image

L-force | PLC Designer

Operands in PLC Designer



DMS 3.2 EN 02/2011 TD29

509

10.2

Variables

Variables can be declared either locally in the declaration part of a POU or in a global
variable list.

Note!

In a project you can define a local variable which has the same name like a global
variable. In this case within a POU the locally defined variable will be used. It is not
allowed however to name two global variables identically. For example you will get
a compiler error,if you have defined a variable "var1" in the PLC Configuration as
well as in a global variables list.

The variable identifier may not contain any blank spaces or special characters, may

not be declared more than once and cannot be the same as any of the keywords.
Capitalization is not recognized which means that VAR1, Var1, and var1 are all the
same variable. The underscore character is recognized in identifiers (e.g., "A_BCD" and
"AB_CD" are considered two different identifiers). An identifier may not have more
than one underscore character in a row. The length of the identifier, as well as the
meaningful part of it, are unlimited.

Variables can be used anywhere the declared type allows for them.

You can access available variables through the Input Assistant.

10.2.1

System Flags

System flags are implicitly declared variables that are different on each specific PLC. To
find out which system flags are available in your system, use the command 'Insert'
'Operand'
An Input Assistant dialog box pops up, select the category System Variable.

10.2.2

Accessing variables for arrays, structures and POUs.

Two-dimensional array components can be accessed using the following syntax:

<Fieldname>[Index1, Index2]

Structure variables can be accessed using the following syntax:

<Structurename>.<Variablenname>

Function block and program variables can be accessed using the following syntax:

<Functionblockname>.<Variablename>

Advertising