Configuring the Modbus Slave ID to IP Address Table Using Modbus Slave IDs
I want my Lantronix Modbus device server to automatically route serial Modbus master requests to Ethernet Modbus slaves using just their slave IDs (Unit IDs). Can I use their Modbus Slave IDs to send Modbus queries directly to their IP Addresses?
Lantronix IAP Modbus device servers running Modbus bridge firmware and set to Master-Attached mode can send serial Modbus master requests to Ethernet Modbus slaves at their individual IP addresses using just their Slave or Unit ID.
This is configured by first setting the Modbus device server to Master-attached mode in the configuration menu. This enables Menu #5 'Unit ID -> IP Address Table', where the Modbus Slave ID to IP address table is configured. To use the Slave ID to automatically configure the Modbus slave's IP address in the table, use zero (0) as the last octet for the IP value when configuring the slave ID to IP Address table.
The formula the UDS follows is x.x.x.0 + SLV ID to produce the IP address of the slave device.
For example:
Configuring the Slave ID to IP address mapping to 192.168.10.0 will cause the Modbus device server to use the Slave ID in the serial Modbus request as the last octet of the mapped IP address. So, slave ID 1 will be automatically mapped to 192.168.10.1, and slave ID 5 will be automatically mapped to 192.168.10.5, and so forth.
The Modbus Bridge - Master Attached configuration menu is shown below:
Lantronix Inc. - Modbus Bridge MAC address 00204A9C2D9E Software version V3.2.0.0 (071005) UDS1100 Press Enter for Setup Mode Model: Device Server Plus+! (Firmware Code:UA) Modbus/TCP to RTU Bridge Setup 1) Network/IP Settings: IP Address ................. 172.18.17.35 Default Gateway ............ 172.18.0.1 Netmask .................... 255.255.0.0 2) Serial & Mode Settings: Protocol ................... Modbus/RTU,Master attached Serial Interface ........... 9600,8,N,1,RS232 3) Modem Control Settings: DTR Output ................. Fixed High/Active RTS Output ................. Fixed High/Active 4) Advanced Modbus Protocol settings: MB/TCP Exception Codes ..... Yes (return 00AH and 00BH) Char, Message Timeout ...... 00050msec, 05000msec 5) Unit ID -> IP Address Table: Close Idle Sockets ......... 10sec Redundant Entry Retry ...... Feature Disabled D)efault settings, S)ave, Q)uit without save Select Command or parameter set (1..5) to change: 5 Close Idle TCP sockets after (3-60 sec, 0=leave open) (10) Redundant entry retries after (15-60 sec, 0=disable feature) (0) (Set 4th octet to 0 to use Slave Address as part of IP) A)dd, D)elete, E)xit - select function Modbus addr from (1) ? 1 Modbus addr to (1) ? 50 Slave IP address (172) .(018) .(017) .(000) 1): 001-050: 172.18.17.0+SLV A)dd, D)elete, E)xit - select function |
Menu Menu option 5 – ‘Unit ID -> IP Address Table’ is where you can set up the Slave ID to IP Address table.
In the example above:
- choose option 5 from the Main Menu to edit the Slave Unit ID to IP Address table
- select ‘A)dd’ entry to the Unit ID to IP Address Table.
The Lantronix IAP device then prompts for the range of Slave ID’s being addressed – ‘Modbus addr from (1) to (1)'. The example above shows that the range of 1 to 50 is being configured. The resulting IP address mapping will make connections to 172.18.17.1 through 172.18.17.50 depending on the Slave ID in the Modbus master request received.
The ability to map the Slave ID to IP Address based on the Slave ID is only available when the 4th octet of the IP address mapping is set to zero. Offsetting the IP Address mapping with values other than zero (example, x.x.x.100+SLV, or x.x.x.200+SLV, etc.) is not possible.
[Originally Published On: 09/21/2009 04:31 PM]