Section: InstRefs
The section InstRefs
defines references to FB instances or structure instances.
SEC InstRefs //optional: yes, modifier: [UPDATE] SEC InstRef : <identifier> //target: yes, optional: yes, modifier [HIDE,UPDATE] Variable := <variable name>; //optional: no, type: InstancePath Desc := <description>; //optional: no, type: text Optional := TRUE/FALSE; //optional: yes, type: BoolFlag END_SEC ... SEC InstRef_Multi : <identifier> //optional: yes, modifier [HIDE,UPDATE] Variable := <variable name>; //optional: no, type: InstancePath Var_Count := <variable for count>; //optional: no, type: InstancePath Desc := <description>; //optional: no, type: text Cardinality := [<minimum> .. <maximum>]; //optional: no, type: Cardinality END_SEC END_SEC
Details regarding the syntax of definition types are described in the section Module Declaration.
Inst_Ref.Variable
defines the input instance path of a variable of typePOINTER TO <T>
or of type<interface>
. (<T>
is any structure or FB type)InstRef_Multi.Variable
defines the input instance path of typePOINTER TO POINTER TO <T>
or of typePOINTER TO <interface>
. (<T>
is any structure or FB type)Two different InstRef or InstRef-Multi entries must not use the same variable.
The target must uniquely identify the instance reference. This means that there must not exist two different instance reference declarations (section
InstRef
andInstRef_Multi
) with the same target (upper or lower case spelling is not relevant).The input integer variable defined by
Var_Count
can only be used once in allVarCounts
ofSlot_Multi
orInstRef_Multi
. Only integer variables defined byVar_Count
ofVarArray
can be used in parallel toVar_Counts
ofSlot_Multi
orInstRef_Multi
.
SEC InstRef_Multi : Elements Variable := piElems ; Var_Count := uiArraySize ; Desc := TL.Elems_Desc ; Cardinality := [1 .. 10] ; END_SEC
Among other declarations the declaration part of the function block must contain: uiArraySize : UINT; piElems : POINTER TO Interface;
piElems
points to a globally created, correctly initialized ARRAY[0..uiArraySize-1] OF interface
or OF POINTER TO <T>
, which points to the individual instances. As a result, the i-th object can be accessed by means of piElems[i]
.