Declaration of a language element with partial address in ST
It is possible to define a not yet fully specified location (= a partial address) for the following language elements:
structure elements for a →structured data type
→variables of a specific section
TYPE
name_1: STRUCT
name_e1 AT %(I|Q|M)* (* optional_begin *) {OFFSET := value} (* optional_end *) : data-type := initial-value;
name_e2 AT %(I|Q|M)* (* optional_begin *) {OFFSET := value} (* optional_end *) : data-type := initial-value;
...
END_STRUCT;
END_TYPE
VAR | VAR_INPUT | VAR_OUTPUT | VAR_GLOBAL | VAR_TEMP
name_3, name_4, ..., name_n1 AT %(I|Q|M)* : type := initial-value; (* Here the variable
'name_n1'
is defined with a partial address. *)
name_5 AT %(I|Q|M)*, name_6 AT %(I|Q|M)*, ... name_n2 : type := initial-value; (* Here the variables
'name_5'
and
'name_6'
are defined with a partial address. *)
...
END_VAR
Meaning of the partial address and of the offset |
|||||||||||||||||||||
Use AT %(I|Q|M)* to assign a partial address to the language element. The location will be specified at a later moment, e.g. in a tool to address the IOs or in a VAR_CONFIG section (for those variables that have been declared using the structure data type). Details: See "Declaring VAR_CONFIG sections within PLC-object". AT %(I|Q|M)* is an optional specification for the language element. Without this specification, no partial address is defined for the language element. Enter a partial address according to this structure:
Enhancement to IEC-standard As an enhancement to the →IEC-standard, it is possible to declare several variables with one partial address or several variables with partial addresses in one line .
Enhancement to IEC-standard The attribute OFFSET is an enhancement to the IEC-standard as well. Restrictions
|
The declaration of partial addresses is possible within these sections:
(Consult the respective description of the section about possibly additional possibilities for the variable.)
Section |
The declaration of the language element is done as: |
VAR ... END_VAR |
internal variable (see "Declaration of internal variables in ST") |
VAR_INPUT ... END_VAR |
input variable (see "Declaration of input variables in ST") |
VAR_OUTPUT ... END_VAR |
output variable (see "Declaration of output variables in ST") |
VAR_GLOBAL ... END_VAR |
global variable (see "Declaration of external variables in ST") |
VAR_TEMP ... END_VAR |
temporary variable (see "Declaration of temporary variables in ST") |
TYPE ... END_TYPE (only for structure elements) |
→structured data type (see " Declaration of a data type in ST ") |
TYPE
MyType1 : STRUCT
Elem1 AT %I* : INT; (* assignment of a not yet fully specified input, no offset *)
Elem2 AT %Q* {OFFSET := 9} : INT; (* assignment of a not yet fully specified output, offset for 'elem2': 9 *)
Elem3 : INT; (* no assignment of a location *)
END_STRUCT;
END_TYPE