Reference programming Overall size through natural alignment with Pack(4) and so-called padding bytes: 20 On CX10xx platforms the member components of structure ST_ALIGN_SAMPLE have the following sizes and offsets: _diField1 (DINT), Offset = 0 (16#0), Size = 4 _byField1 (BYTE), Offset = 4 (16#4), Size = 1 _iField (INT), Offset = 5 (16#5), Size = 2 _byField2 (BYTE), Offset = 7 (16#7), Size = 1 _diField2 (DINT), Offset = 8 (16#8), Size = 4 _pField (POINTER TO BYTE), Offset = 12 (16#C), Size = 4 Overall size: 16 Display of structure ST_ALIGN_SAMPLE for CX90xx platforms (RISC) with representation of the padding bytes : TYPE ST_ALIGN_SAMPLE: STRUCT _diField1 : DINT; _byField1 : BYTE; _byPadding :
BYTE; _iField : INT; _byField2 : BYTE; _a_byPadding : ARRAY[0..2] OF BYTE; _diField2 : DINT; _pField : POINTER TO BYTE; END_STRUCT END_TYPE 7.1.2.5 References (Alias types) You can use the user-defined derived data type to create an alternative name for a variable, constant or function block. Create your references as objects in the Object Organizer under the register card Data types. They begin with the keyword TYPE and end with END_TYPE. Syntax: TYPE : term>; END_TYPE Example: TYPE message:STRING[50]; END_TYPE; 7.1.2.6 Subrange types A sub-range data type is a type whose range of values is only a subset of that of the basic type.
The declaration can be carried out in the data types register, but a variable can also be directly declared with a subrange type: Syntax for the declaration in the 'Data types' register: TYPE : ( .. ) END_TYPE; Example: TX1200 189 Version: 1.3 Type Description must be a valid IEC identifier is one of the data types SINT, USINT, INT, UINT, DINT, UDINT, BYTE, WORD, DWORD (LINT, ULINT, LWORD). Is a constant which must be compatible with the basic type and which sets the lower boundary of the range types. The lower boundary itself is included in this range. Is a constant that must be compatible with the basic type, and sets the upper boundary of the range types.
The upper boundary itself is included in this basic type.