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

Page 261

Advertising
background image

L-force | PLC Designer

Editors in PLC Designer



DMS 3.2 EN 02/2011 TD29

259

7.2.12

Variables declaration

A variables declaration has the following syntax:

<Identifier> {AT <Address>}:<Type> {:=<initialization>};

The parts in the braces {} are optional.

Regarding the identifier, that is the name of a variable, it should be noted that it may
not contain spaces or umlaut characters, it may not be declared in duplicate and may
not be identical to any keyword. Upper/lowercase writing of variables is ignored, in

other words VAR1, Var1 and var1 are not different variables. Underlines in identifiers
are meaningful, e.g. A_BCD and AB_CD are interpreted as different identifiers.
Multiple consecutive underlines at the beginning of an identifier or within a identifier
are not allowed. The length of the identifier, as well as the meaningful part of it, are
unlimited.

All declarations of variables and data type elements can include initialization. They are
brought about by the ":=" operator. For variables of elementary types, these
initializations are constants. The default-initialization is 0 for all declarations.

Example:

iVar1:INT:=12; (* Integer variable with initial value of
12*)

If you wish to link a variable directly to a definite address, then you must declare the
variable with the keyword AT.

For faster input of the declarations, use the shortcut mode.

In function blocks you can also specify variables with incomplete address statements.
In order for such a variable to be used in a local instance, there must be an entry for it
in the variable configuration.

Pay attention to the possibility of an automatic declaration.

Note!

Regard the possibility of using pragmas to affect the properties of a variable
concerning the compilation resp. precompilation process.

Advertising