Declaration of a structured data type with partial address in ST

In case of structure elements for a structured data type, it is possible to define a not yet fully specified location (= a partial address).

Syntax
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

Meaning of the partial address and of the offset

Use AT %(I|Q|M)* to assign a partial address to the structure element. The location will be specified in a VAR_CONFIG section, in particular for the variable that has been declared using the structure data type. Details: See "Declaring VAR_CONFIG sections within PLC-object".

Enter a partial address according to this structure:


Character

Meaning

1.

%

initiates the address

2.

prefix for location

defines the location


I

input


Q

output


M

memory

3.

*

not yet fully specified location
(replaces the prefix for the size and the integers as they are defined for a full physical address)

Use the optional attribute OFFSET to define a relative offset after the address.

Restrictions

  • logi.CAD 3 provides no validation whether the locations are fully specified in a VAR_CONFIG section.

  • Moreover, logi.CAD 3 does not check the section of the variable for which a structured data type with partial addresses is declared. Moreover, it is possible to use such data types for all variables sections supported in logi.CAD 3. This is in contrast to the specification of the →IEC-standard that a structured data type with partial address must not be used for →input variables, →in-out variables or →temporary variables.

  • As the code is not created for the VAR_CONFIG sections yet, the definition of not yet fully specified locations have no impact on the execution of the application.

Enhancement to IEC-standard

The attribute OFFSET is an enhancement to the →IEC-standard.

Moreover, logi.CAD 3 allows you to specify additional data for the declaration . See " Defining description, comment or JSON string for variables and data types " for details.

Example
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