Slave ID Shifting

Slave ID shifting is very useful for situations when you need to work with Modbus Slaves that do not allow ID changing (or allow ID changing in a limited range).

For example, suppose you have a Modbus TCP Master that needs to work with two Modbus RTU Slaves located on serial ports 1 and 2. Obviously, the Master needs the IDs of these Slaves to be different, for example, 1 and 2, but it just so happens that both Slaves have the same fixed ID equal to 1. No problem, ID shifting to the rescue!

For the above example, use the Slave ID-based routing :

• Configure the first ID range as follows:

o ID From = 1

o ID To = 1

o ID Shift = 0

o Destination = Serial 1

• Configure the second ID range as follows:

o ID From = 2

o ID To = 2

o ID Shift = -1

o Destination = Serial 2

routing-shift-slave-id

ID shift for the first range is 0, which means that there is no shift. When the Modbus TCP Master sends a request to the Slave with ID = 1, this request will be forwarded, unchanged, to serial port 1. ID shift for the second range is -1, which means that 1 will be subtracted from the ID of any request in this range. When the Modbus TCP Master sends a request to the Slave with ID = 2, this request will be forwarded to serial port 2. The ID number in this request will be modified: -1 will be added to the original ID specified by the Master. Therefore, the resulting ID field in the routed message will be set to 1, just as needed by the intended recipient of the request!

ID shifts can be positive, as well as negative. It is possible to use ID shifting with Slave ID-based routing and TCP port-based routing .