EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers.

Variables Initialization

Default Initialization Value

The default initialization value is 0 for all declarations, but you can add user-defined initialization values in the declaration of each variable and data type.

User-Defined Initialization Values

The user-defined initialization is brought about by the assignment operator := and can be any valid ST expression. Thus, constant values as well as other variables or functions can be used to define the initialization value. Verify that a variable used for the initialization of another variable is already initialized itself.

Example of valid variable initializations:

VAR
var1:INT := 12;               * Integer variable with initial value of 12. *
x : INT := 13 + 8;            * Integer value defined an expression with literal values.*
y : INT := x + fun(4);        * Integer value defined by an expression containing a function call. NOTE: Be sure that any variables used in the variable initialization have already been defined. *
z : POINTER TO INT := ADR(y); * POINTER is not described by the IEC61131-3: Integer value defined by an address function; NOTE: The pointer will not be initialized if the declaration is modified online. *
END_VAR

Further Information

For further information, refer to the following descriptions:

oinitializing arrays

oinitialization of structures

oinitialization of a variable with a subrange type

NOTE: Variables of global variables lists (GVL) are initialized before local variables of a POU.

NOTE: As from SoMachine version 4.0, variables in a function block are initialized in the following order: First, the constants in accordance with the order of their declarations, then the other variables in accordance with the order of their declarations.

For further information regarding initialization order, refer to the Attribute global_init_slot.