Attribute global_init_slot, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 996

Advertising
background image

L-force | PLC Designer

Programming Reference

994

DMS 4.1 EN 03/2011 TD29

Attribute Global_init_slot
The pragma {attribute 'global_init_slot'} can only be applied for signatures. Per default
the order of initializing the variables of an global variable list is arbitrary. However, in
some cases prescribing an order is necessary, e.g. if variables of one global list are
referring to variables of another list. In this case you may make use of the pragma to
arrange the order for global initialisation.
Syntax:
{attribute 'global_init_slot’ := '<Value>'}
The template <Value> has to be replaced by an integer value describing the
initialisation order of the signature. The default value is 50000. A lower value provokes
an earlier initialisation. In case of signatures carrying the same value for the attribute
'global_init_slot' the sequence of their initialization rests undefined.
Example:
Assume the project including two global variable lists GVL_1 and GVL_2:

The global variable "A" is member of the exemplary global variable list GVL_1:

{attribute 'global_init_slot' := '300'}
VAR_GLOBAL
A : INT:=1000;
END_VAR

The initial values of the variables "B" and "C" of GVL_2 depend on variable "A".

{attribute 'global_init_slot' := '350'}
VAR_GLOBAL
B : INT:=A+1;
C : INT:=A-1;
END_VAR

Setting the attribute 'global_init_slot' of GVL_1 to 300, i.e. to the lowest value in the
exemplary initialisation order, makes sure that the expression "A+1" is well defined
when initialising "B".

Advertising