All elements of the same data type (BOOL, WORD, INT, DWORD, DINT, REAL and STRING with the same string length) are lumped together and allocated one after the other beginning from a common starting address. Arrays are also allocated to this common starting address.
The following conditions apply to this starting address: If a DUT consists of BOOL or ARRAY OF BOOL type elements, it is stored in a memory area reserved for bits; otherwise it is stored in a memory area reserved for 16-bit words.
To avoid ambiguity during initialization, no initialization is allowed. The following default initializations are executed:
Data type |
Initial value |
---|---|
BOOL |
FALSE |
WORD, INT, UINT, DWORD, DINT, UDINT |
0 |
REAL |
0.0 |
STRING |
'' (empty string) |
The address occupied by the maximum string length is initialized with the maximum length of the string that is greater or equal to zero. The rest of the string is initialized with zeros.
All element variables of the data type STRING must be located at the end of the declaration.
In general, you should pay attention to how memory area is occupied by the data types used.
Especially when using STRING elements, note that their particular way of occupying memory allows them to be repeatedly overwritten with the help of other elements.
Ensure the maximum string length and the current string length are valid values before using string commands.
A DUT cannot be used as a variable of an overlapping DUT.
DUT without elements of the data type BOOL DUTwithoutBOOLs:
How DUTs with overlapping elements occupy memory:
16-bit word area |
||||||
---|---|---|---|---|---|---|
DT100 |
WORD1 |
DWORD1 |
INT1 |
DINT1 |
REAL1 |
STRING1 |
DT101 |
WORD2 |
INT2 |
||||
DT102 |
DWORD2 |
DINT2 |
||||
DT103 |
||||||
STRING2 |
The variables STRING1 and STRING2 must have the same length and be at the end of the declaration.
DUT DUTwithBOOLs with elements of the data type BOOL (no address defined by the user):
How DUTs with overlapping elements occupy memory:
Bit area |
||||||||
---|---|---|---|---|---|---|---|---|
WR10 |
Bool14 |
Bools[04] |
WORD1 |
DWORD1 |
INT1 |
DINT1 |
REAL1 |
STRING1 |
WR11 |
WORD2 |
INT2 |
||||||
WR12 |
DWORD2 |
DINT2 |
||||||
WR13 |
The variable STRING1 must be located at the end of the declaration.
DUT with Arrays:
How DUTs with overlapping elements occupy memory:
16-bit word area |
||||
---|---|---|---|---|
DT100 |
String1_Max |
String_Parts[1,1] |
String1 |
StringS[1] |
DT101 |
String1_Act |
String_Parts[1,2] |
||
DT102 |
String1_Char12 |
String_Parts[1,3] |
||
DT103 |
String1_Char34 |
String_Parts[1,4] |
||
DT104 |
String2_Max |
String_Parts[2,1] |
String2 |
StringS[2] |
DT105 |
String2_Act |
String_Parts[2,2] |
||
DT106 |
String2_Char12 |
String_Parts[2,3] |
||
DT107 |
String2_Char34 |
String_Parts[2,4] |
The variables String1, String2 and Strings must have the same length and be at the end of the declaration.
Common overlapping DUTs are already predefined in the FP tool library.