Troubleshooting the Modbus Interface
Industrial Communication Toolbox™ supports the Modbus® interface over TCP/IP or Serial RTU. You can use it to communicate with Modbus servers, such as controlling a PLC (Programmable Logic Controller), communicating with a temperature controller, controlling a stepper motor, sending data to a DSP, reading bulk memory from a PAC controller, or monitoring temperature and humidly on a Modbus probe.
Using the Modbus interface, you can do the following tasks:
Read coils, inputs, input registers, and holding registers
Write to coils and holding registers
Perform a combination of one write operation and one read operation on groups of holding registers in a single Modbus transaction
Modify the contents of a holding register using a mask write operation
Supported Platforms
Industrial Communication Toolbox supports the Modbus interface over TCP/IP or Serial RTU. It is supported on the following platforms.
Linux® 64-bit
macOS 64-bit
Microsoft® Windows® 64-bit
Configuration and Connection
If you are connecting to a local or remote device over Modbus, make sure that the device is powered on and available.
Industrial Communication Toolbox can communicate over Modbus using TCP/IP or Serial RTU. If you are connecting via TCP/IP, you need to know the IP address or host name of the Modbus server. If you are connecting via Serial RTU, you need to specify the Serial port the Modbus server is connected to.
Make sure you can create the
modbus
object with its necessary arguments. For examples of creating the object and information about the required arguments, see Create a Modbus Connection.When you create the
modbus
object, it connects you to the server or device. There is no separate connection function required.When you have connected, you can communicate with your device. See Read Temperature from a Remote Temperature Sensor for an example of communicating with a device. See Other Troubleshooting Tips for Modbus for tips about communication issues after initial connection.
Other Troubleshooting Tips for Modbus
These tips may be relevant to your use of the Modbus interface.
Address Range
When specifying read and write addresses, the addresses must be in the range 0–65535.
Underlying Interface
You might encounter connection problems that are due to the underlying TCP/IP or Serial Port connections, rather than being specific to the Modbus interface.
Byte Order
When configuring a Modbus client you must match the byte order and word order with that of the Modbus server. To know these details about Modbus server, see vendor documentation.
Modbus Addresses
If you have trouble figuring out a Modbus address, see the vendor documentation of the device. For example, you may need to map a PLC register to the Modbus address for the register. The vendor documentation may help.
Some vendors include an extra digit in addresses that gets dropped. For example 43233 is really address 3233. Devices are usually represented by a four-digit address, and some vendors use a 5th digit to represent the type of target, for example, coils. So you may need to adjust an address to account for this if your device vendor does that.
The Modbus functions use 1-based addressing, not 0-based addressing like Modbus uses. The toolbox subtracts 1 from any addresses that are passed in via the address parameters in the read and write functions.