Main Content

Modbus Communication

Communicate with Modbus® servers to access controllers, probes, and other instruments

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, 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 humidity on a Modbus probe.

Create the interface object using the modbus function, and use the read, write, writeRead, and maskWrite functions for communication.

For an example that shows the entire workflow of reading a register from a PLC, see Read Temperature from a Remote Temperature Sensor.

You can also read and write to coils and registers using the Modbus Explorer, which offers a user interface to easily set up reads and writes, and a live plot to see the values. For information, see Use the Modbus Explorer App. For an example that shows the entire workflow of reading and writing to a PLC using the app, see Control a PLC Using the Modbus Explorer.

You can read or write data to a Modbus TCP/IP or Serial server using the Modbus client blocks in Simulink®. For an example, see Control Water pH Remotely Using Modbus Client Blocks in Simulink.

Blocks

Modbus Client ReadRead data from Modbus server (Since R2024b)
Modbus Client WriteWrite data to Modbus server (Since R2024b)

Functions

modbusCreate Modbus object
readRead data from Modbus server
writePerform a write operation to the connected Modbus server
writeReadPerform write and read operation on groups of holding registers in single Modbus transaction
maskWritePerform mask write operation on a holding register

Apps

Modbus ExplorerRead and write to Modbus coils and registers

Topics

Modbus Communication Using Programmatic Workflow

Modbus Communication Using Simulink

Modbus Communication Using the Modbus Explorer

Troubleshooting

Troubleshooting the Modbus Interface

Try these tips if you have problems using the toolbox Modbus interface. See information about Modbus supported platforms, configuration and connection, and other interface-specific tips.

Featured Examples