Variables

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Variables

mapp Services V5.16

Variables are declared above the Structured Text program or in the separate files.

Declaration

Define new variables with their name and type.

Map existing process variables.

Syntax

VAR [{[<Storage>][<Mapping>][<IP retain mode>][<Synchronization>]}]
  Variable declarations
END_VAR

Parameter

Storage location

Mapping variables

IP retain mode

Initialization

Variables can be set to a specific initial value after the file is loaded.

Starting a program that is already loaded does not initialize the variables. To prevent confusion, it is strongly recommended to use initialization for constants only.

A program is loaded automatically when it is started for the first time. If an already-loaded program is restarted, then it will not be reloaded if it has not been modified.

If a variable is mapped to the PLC, then the initial value in the Structured Text program or interpreter declaration file is ignored.

Example

VAR CONSTANT
  MAX_CLIENTS := 5;
  ARRAY_SIZE : ARRAY[0..4] OF DINT := [4(1), 2];
END_VAR

Topics in this section:

Declaration

Initialization

Storage location

Mapping variables

IP retain mode

Aliases for process variables

Arrays

Dynamic variables