- Home
- IEC 61131-3 Programming
- Variables
- Rules for Assigning Ports and Variables
Rules for Assigning Ports and Variables
The following rules apply when mapping ports in the GDS Port List and variables in Data Lists.
Use case 1: Both data types to be assigned are elementary data types...
- If both data types are from the PLCnext/C++ domain, the following assignments are possible:
StartPort EndPort boolean boolean uint8 uint16 uint32 uint64 char8 int8 int16 int32 int64 float32 float64 char8 char8 uint16 uint32 uint64 int16 int32 int64 float32 float64 uint8 uint8 uint16 uint32 uint64 int16 int32 int64 float32 float64 uint16 uint16 uint32 uint64 int32 int64 float32 float64 uint32 uint32 uint64 int64 float64 uint64 uint64 int8 int8 int16 int32 int64 float32 float64 int16 int16 int32 int64 float32 float64 int32 int32 int64 float64 int64 int64 float32 float32 float64 float64 float64 - If at least one type is from a non-PLCnext/C++ domain, the types have first to be mapped according to the table "Data type mapping table: IEC 61131 - PLCnext - Fieldbus" below. Afterwards, they can be assigned as shown in the previous item.
- If at least one type is from Fdcml domain and is mapped to an array in the PLCnext/C++ domain (like BitstringX), the assignment is possible as described in "Use case 2".
Use case 2: both data types to be assigned are arrays...
Precondition: assignment is only possible if the element counts are equal.
- If the array base types are elementary, the following is distinguished:If both base types are from the PLCnext/C++ domain, the assignment is possible if the base types match exactly.If at least one base type is from a non PLCnext/C++ domain, the base types have to mapped to the PLCnext/C++ domain according to the table "Data type mapping table: IEC 61131 - PLCnext - Fieldbus" below. Afterwards, an assignment is possible if the mapped base types match exactly.
- If the array base types are structures, assignment is possible according as described in the following section "Use case 3".
Use case 3: both data types are structures
Precondition: assignment is only possible if the structure field count and field names match (ignore case).
- If both field types are elementaries from the PLCnext/C++ domain, assignment is possible if the types match exactly.
- If both field types are elementaries and at least one field type is from a non PLCnext/C++ domain, first the field types have to be mapped according to the table "Data type mapping table: IEC 61131 - PLCnext - Fieldbus" below. Afterwards, an assignment is possible if the mapped types match exactly.
- If both field types are arrays, an assignment is possible according to "Use case 2".
- If both field types are structures, an assignment is possible according to the current "Use case 3" list.
- If both field types are enumerations, an assignment is possible according to "Use case 4".
Use case 4: both data types are enumerations
- If both base data types are from the PLCnext/C++ domain, assignment is possible if the base types match exactly.
- If at least one base type is from a non PLCnext/C++ domain, first the base types have to be mapped according to the table "Data type mapping table: IEC 61131 - PLCnext - Fieldbus" below. Afterwards, an assignment is possible if the mapped types match exactly.
- Assignment is possible if the string capacities are equal.
- Wide strings can only be assigned to wide strings, non-wide strings can only be assigned to non-wide strings.
The assignment of arrays to (process datum) ports with elementaries of the datatype OctetString[n] or BitString[n] is possible if the overall data size matches.
Note
Only possible for PLCnext controllers with firmware 2021.6 or higher. |
Use case 7: special handling of safe FDCML datatypes (i.e., safe process datum)
The assignment of elementaries with safe FDCML datatypes is only possible when the data lengths are equal.
Use case 8: both types are user-defined types from the IEC domain or FDCML domain
User-defined IEC types are auto-generated based on the data types of the process data which are defined in the FDCML file of the controller involved. This happens during their instantiation. They are then stored and compiled with the project. The FDCML DataTypeRepository is updated dynamically with these process data types of the currently opened project. They are unloaded when closing the project.
This way, an IEC 61131-3 variable or a PLCnext port (which has a data type defined in the IEC domain) can be assigned to an element (e.g., a process data item or port) with a data type defined in the FDCML domain.
Use case 9: Connecting structure (STRUCT) members using the Role Picker in the Port List
- An existing IN port or OUT port with an elementary type as source role can be connected to all compatible ports including struct members.
- The new line (last row) of the Port List offers all available OUT ports including STRUCT members to be picked as source port for further connections.
- The new line (last row) of the Port List offers all available IN ports including struct members to be picked as source port for further connections.
Data type mapping table: IEC 61131 - PLCnext - Fieldbus
No. of bits | IEC61131 | PLCnext | Fieldbus |
---|---|---|---|
1 | BOOL | bit | Bit |
1 | BOOL | bit | BOOL |
8 | BOOL | boolean | Boolean |
8 | BYTE | uint8 | Bitstring8 |
8 | BYTE | uint8 | BYTE |
8 | BYTE | uint8 | Octetstring1 |
8 | SINT | int8 | Signed8 |
8 | SINT | int8 | SINT |
8 | USINT | uint8 | Unsigned8 |
8 | USINT | uint8 | USINT |
16 | INT | int16 | INT |
16 | INT | int16 | Signed16 |
16 | UINT | uint16 | UINT |
16 | UINT | uint16 | Unsigned16 |
16 | WORD | uint16 | Bitstring16 |
16 | WORD | uint16 | Octetstring2 |
16 | WORD | uint16 | WORD |
32 | DINT | int32 | DINT |
32 | DINT | int32 | Signed32 |
32 | DWORD | uint32 | Bitstring32 |
32 | DWORD | uint32 | DWORD |
32 | DWORD | uint32 | Octetstring4 |
32 | REAL | float32 | Float32 |
32 | REAL | float32 | REAL |
32 | TIME | uint32 | TIME |
32 | UDINT | uint32 | UDINT |
32 | UDINT | uint32 | Unsigned32 |
64 | INT64 | int64 | LINT |
64 | LDATE | int64 | LDATE |
64 | LDATE_AND_TIME | int64 | LDATE_AND_TIME |
64 | LDT | int64 | LDT |
64 | LINT | int64 | Signed64 |
64 | LREAL | float64 | Float64 |
64 | LREAL | float64 | LREAL |
64 | LTIME | int64 | LTIME |
64 | LTIME_OF_DAY | int64 | LTIME_OF_DAY |
64 | LTOD | int64 | LTOD |
64 | LWORD | uint64 | Bitstring64 |
64 | LWORD | uint64 | LWORD |
64 | LWORD | uint64 | Octetstring8 |
64 | ULINT | uint64 | ULINT |
64 | ULINT | uint64 | Unsigned64 |
n*8 | STRING | IecString | StringASCII |
n*8 | Array of uint8 | OctetstringN |