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 keywordAT.

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.