Revision 1.1
WebSwitch™ Users Manual
Regardless of the addressing scheme used, it is important to note that when the control password in
WebSwitch™ is enabled, Modbus/TCP communications are disabled. This is because Modbus/TCP
does not provide a mechanism for password protection. Make sure the control password is disabled
(default) before using Modbus with WebSwitch™. Also, Modbus functionality must be enabled on the
Advanced Network
tab before the device will respond to Modbus requests.
WebSwitch™ supports the following function code/memory types:
━
Read Coils (Modbus function 01): Read the status of the outlets (and/or inputs).
━
Read Discrete Inputs (Modbus function 02): Read the status of the inputs.
━
Read Holding Registers (Modbus function 03): Read values of sensors.
━
Write Single Coil (Modbus function 05): Change the outlet state.
These function codes/memory types and addresses can be converted to the PLC addressing equivalent
using the table below. To use the table, look up the row corresponding to the Modbus function code.
Then take the desired Modbus address and add to it the address offset found in the column for the PLC
addressing mode desired.
PLC Addressing 485 Mode
PLC Addressing 584/984
Read Coils (function 01)
Addr + 1
Addr + 1
Write Coils (function 05)
Addr + 1
Addr + 1
Read Discrete Inputs (function 02)
Addr + 1001
Addr + 10001
Read Holding Registers (function 03)
Addr + 4001
Addr + 40001
For example, to read the state of Outlet 1 (coil 1), the Modbus function code 01 is used. To convert this
code/address pair to a PLC address, we look up the read coils row from the table above and see that
adding 1 to the address gives us a PLC address of 2.
Multiple commands may be sent without closing and re-opening the connection, but if no data is
transferred for 50 seconds, the connection will time out and close. To keep the connection open, a read
request can be sent periodically. WebSwitch™ has two TCP sockets available for Modbus/TCP, which
allows two connections to be open at one time. Request for more than two open connections will be
rejected.
When errors occur, an error code is sent. Most Modbus client software will interpret this code into a
human readable form. This code is comprised of the function code sent plus 0x80. For example, an error
during the read coils function 0x01 would return 0x81. Each error has a qualifying exception number.
The following are the possible exception codes and their meanings:
━
0x01 - Function code not supported (also returned when Modbus is disabled in the setup pages).
━
0x02 - Incorrect starting address/quantity of outlets combination.
The remaining sections give a detailed, low-level description of the Modbus functions supported.
Xytronix Research & Design, Inc.
74