Description of the PLC data area parameter values
The parameter values to be used for the write/read command differ depending on the type of external control used, the adapter or the communication protocol. Some data areas may not be available, or the data have to be read/written word by word instead of byte by byte . Further information can be found in the documentation for the external control.
Format conversion necessary
Read access to word variables in the S5/S7 controller returns data in Motorola format (Hi and Lo bytes interchanged). For the evaluation the read data first have to be converted to the common Intel format used in the TwinCAT system. Data to be written from the TwinCAT system to the S5/S7 controller must be converted to the Motorola format before the write access. The BCD number system is used in the S5/S7 controller for representing the counter/timer variables. The data may have to be converted, if necessary.
The TwinCAT PLC library TcUtilities.Lib offers functions for conversion between Motorola and Intel format (e.g. BE16_TO_HOST, HOST_TO_BE16...). |
The following table provides an overview of the available communication paths:
Control | LAN adapter | Transport protocol | LAN adapter communication protocol | Description |
---|---|---|---|---|
S5 | IBH Link S5++ | TCP/IP | No connection parameterization required in the external control. | |
S7 | IBH Link S7++ | TCP/IP | No connection parameterization required in the external control. |
IBH S5 LAN link protocol = FETCH/WRITE telegrams
- This protocol can currently only be used with S5 controllers;
- The TCP/IP port number has the default value: 2002;
- The parameter devAddr is not evaluated;
- The data block number (nDB) is only evaluated when the areas data blocks (DB) and extended data blocks (DX) are accessed. Permissible range: 1..255;
- The areas P (periphery) and OS (operating state) are not supported;
Data area (eArea) | Start address (nOffset) | Permitted data length (cbBuffer) |
---|---|---|
DB | Data word offset: 0..2047 | read/write 1..2048 words |
M | Flag byte offset: 0..255 | read/write 1..256 bytes |
I | Input byte offset: 0..127 | read 1..128 bytes |
Q | Output byte offset: 0..127 | write 1..128 bytes |
P | I/O peripheral byte offset: 0..127 (digital I/Os), 128..255 (analog I/Os) | read/write 1..256 bytes |
C | Counter start offset: 0..255 | read/write 1 word |
T | Timer start offset: 0..255 | read/write 1 word |
DX | Data word offset | read/write 1..2048 words |
NetLink MPI protocol (NL-MPI) from Hilscher
- This protocol can only be used with S7 controllers;
- The TCP/IP port number has the default value: 1099
- The MPI address (devAddr) has the default value: 2. Permissible values: 1..126;
- The data block number (nDB) is only evaluated when the data blocks (DB) data area is accessed. Permissible values: 0-65534;
- The areas P (periphery) and DX (extended data block) are not supported;
- The byte length has to be specified for the data length parameter (cbBuffer);
- The OS area (operating state) is only available for read access;
Data area (eArea) | Start address (nOffset) | Permitted data length (cbBuffer) |
---|---|---|
DB | Data byte offset: 0..65534 | Read: max. 222 bytes, write: max. 216 bytes |
M | Flag byte offset: 0..65534 | |
I | Input byte offset: 0..65534 | |
Q | Output byte offset: 0..65534 | |
C | Counter start offset: 0..65534 | Read: max. 111 word counters, write: max. 108 counters |
T | Timer start offset: 0..65534 | Read: max. 111 word timers, write: max. 108 timers |
OS | Operating state: irrelevant | 1 word (0=STOP, 1=START, 2=RUN, 3=UNKNOWN) |