-

Constant Variables

The constant variable (VAR_CONSTANT acc. to the IEC 61131-3) has a value that cannot be changed by the running application (read-only access). Constant variables can be declared in the variables table or data list by selecting the 'Constant' attribute of a variable (see also the following rules) or in data type worksheets using a VAR CONSTANT...END_VAR declaration block (see below).

The following rules apply for constant variables:

Declaration in data type worksheet (local constant)

Constant variables are declared in the data type worksheet using a VAR CONSTANT...END_VAR declaration block (see the following example). The initialization value of a constant variable must be a literal (expressions for the initialization value are not supported).

Note
Declared constants can only be used in the current and other data type worksheets as initial value in structures and arrays.