Quick overview
1. Demo product
2. Configuration tool
Siemens TIA Portal
3. Communication mode
XB6S-C01SP configured as a Modbus RTU master, connected to a Siemens PLC via XB6S-PN2002
4. Demo slave
Encoder supporting the Modbus RTU protocol (read/write operations with function codes 03/06/10)
5. Operations involved
Serial port parameter configuration, control word setting, node parameter entry, I/O address read/write and communication status diagnostics
How can the Siemens PLC be connected to Modbus RTU slave devices and register read/write be implemented in TIA Portal via the Solidot slice PROFINET protocol Coupler XB6S-PN2002 combined with the serial Communication module XB6S-C01SP?
XB6S-PN2002 handles communication with the PLC on the PROFINET side, and XB6S-C01SP handles the Modbus RTU master function on the serial side. Together they allow all operations in TIA Portal: serial parameter configuration, node command entry, and I/O address read/write. This document uses an encoder supporting the Modbus RTU protocol as an example to demonstrate the complete configuration method for function codes 03/06/10.
1. Demo slave description
In this example, an encoder supporting the Modbus RTU protocol is used as the slave. The following three target register operations are found in its manual:
• function code 03: read 2 registers (read the encoder current value);
• function code 06: write a single register (reset zero point);
• function code 10: write 2 registers (set the current position).
Register Address | Description | Value range | Supported function | Remarks | |
0 x 0000 ... 0 x 0001 | Encoder value | .. 0xFFFFFFFF | 0 x 03 |
|
|
0 x 0002 | Encoder revolution count value | .. 0xFFFF | 0 x 03 |
| |
0 x 0003 | Encoder single-turn value | .. 0xFFFF | 0 x 03 |
| |
0 x 0004 | Encoder address | 1-255 | 0 x 06 | Communication address | |
0 x 0008 | Encoder reset | 0 x 0001 | 0 x 06 | Write 0 x 0001, the encoder uses |
0 x 0009 | Encoder value | 0 x 0000 ... 0 x 0001 | 0 x 06 | 0 x 00: Clockwise |
0 x 000 A | Encoder angular velocity | .. 65535 (ms) | 0 x 06 | Default: 100 ms |
0 x 000B ... 0 x 000C | Encoder setting | .. 0xFFFFFFFF | 0 x 10 | Set the Encoder current position value |
0 x 000E | Encoder setting | 0 x 0001 | 0 x 06 | Write 0 x 0001; the Encoder uses |
0 x 000F | Encoder settings | 0 x 0001 | 0 x 06 | Write 0 x 0001, the encoder uses |
0 x 0020 ... 0 x 0021 | Encoder angular velocity value | -2147483648 ... 2147483647 | 0 x 03 | Signed integer |
2. Configuring serial communication parameters in TIA Portal
In TIA Portal, select the XB6S-C01SP module, click "Properties" → "Module Parameters", and set the communication mode to "Modbus RTU master".



Set the baud rate, stop Bit, character format, and Parity mode according to the slave's serial parameters, and make sure the master and slave configurations match exactly.
Recommended control word parameters
If the control word is to be enabled, it is recommended to select "Level trigger" for the control mode, and set the response timeout to 200 ms and the Polling delay to 100 ms for greater communication stability.

Note: With default parameters, the Polling speed is relatively fast, and some slower-responding slave devices may not respond in time and report an error. Appropriately extending the response timeout and Polling delay can effectively improve communication stability.
Frame Interval parameter description
In general, leave the Frame Interval at the default 1.5T. If the serial debugging assistant communicates normally with the module and also with the slave device, but the module cannot communicate with the slave device, try gradually increasing the Frame Interval and testing.
3. Node parameter configuration
When the communication mode is Modbus RTU master and the control word has been enabled, fill in the parameters node by node according to the following rules. This example configures 3 commands, requiring nodes 1 to 4 in total:
Node | Parameter | Value to write | Corresponding command description |
Node 1 | Parameter 1 | 3 (3 nodes used in this example) | — |
Node 1 | Parameter 2 | 0 (default) | — |
Node 2 | Parameter 1 | 770 (0 x 00000302) | Function code 03, read 2 registers (encoder value), start address 0 x 0 |
Node 2 | Parameter 2 | 1 (slave station number) | — |
Node 3 | Parameter 1 | 526079 (0 x 000806FF) | Function code 06, write single register (reset zero point), start address 0 x 8 |
Node 3 | Parameter 2 | 1 (slave station number) | — |
Node 4 | Parameter 1 | 722434 (0 x 000B0602) | Function code 10, write 2 registers (set current position), start address 0xB |
Node 4 | Parameter 2 | 1 (slave station number) | — |

Note: For node 1, parameter 1 is the number of Nodes actually used this time (3 in this example). From node 2 onward, each node corresponds to one Modbus command; parameter 1 is the decimal value converted from hexadecimal format, and parameter 2 is the slave Station number.
4. I/O address read/write and communication status diagnostics
After configuration is complete, control commands are sent via the Q addresses and status is read via the I addresses.

In this example, all addresses start at 0. The addresses are defined as follows:
6.3.1 Modbus master station process data | |||
Upstream data (32 bytes) | |||
byte number | Functions | Meaning | Address range |
1 | status word | Bit0: Idle state | 1 byte |
Bit1: Busy state, i.e. data transmission in progress | |||
Bit2: Completion state, i.e. data transmission complete | |||
2 | alarm code | See alarm code | 1 byte |
3 | Input Data | Serial Communication module input data | the last 30 bytes |
4 | Input Data | ||
… | … | ||
32 | Input Data | ||
Downstream data (32 bytes) | |||
byte number | Functions | Meaning | Address range |
1 | control word | When the configuration parameter control mode is level, set to 1 to send data | 1 byte |
When the configuration parameter control mode is Rising Edge, 0- > 1 sends data | |||
2 | Output Data | Serial Communication module output data | the last 31 bytes |
3 | Output Data | ||
… | ... | ||
32 | Output Data | ||
Note: The process data in the table above is for 1 node configured in level or Rising Edge mode. If two nodes are configured, byte numbers 1 | |||


Node 2 participates in polling only when QB0=1. Likewise, to enable node 3 and node 4, QB1=1 and QB2=1 must be assigned.
During normal communication, status word BIT0/BIT1/BIT2 change; for example, the value of IB0 is typically seen alternating between 2 and 5, while the alarm code remains 0. If communication is abnormal, check the alarm code.
6.3.7 Modbus alarm code | |
fault code | Comment |
0 x 00 | No error |
0 x 01 | Slave device address error |
0 x 02 | Function code error |
0 x 03 | CRC check error |
0 x 04 | Response byte count error |
0 x 05 | Coil register data error |
0 x 06 | Holding register data error |
0 x 07 | Illegal data address |
0 x 08 | Slave device fault |
0 x 09 | LRC check error |
0 x 0C | Data length error |
0 x 0D | Data conversion error |
0 x 0E | ASCII frame error |
0 x 0F | Response timeout |