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
and use the
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 graphical 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.
|Modbus Explorer||Read and write to Modbus coils and registers|
Modbus Communication Using Programmatic Workflow
- Modbus Interface Supported Features
Use Industrial Communication Toolbox Modbus support to communicate with Modbus servers and applications over TCP/IP or Serial RTU.
- Create a Modbus Connection
Create a Modbus object with the
modbusfunction, to connect to a Modbus interface.
- Configure Properties for Modbus Communication
Use properties to set up Modbus communication during or after object creation.
- Read Data from a Modbus Server
modbusobject to read coil, input, and register data from the Modbus server.
- Read Temperature from a Remote Temperature Sensor
Read temperature and humidity measurements from a remote sensor on a PLC connected via TCP/IP.
- Write Data to a Modbus Server
modbusobject to write coil and holding register data to the Modbus server.
- Write and Read Multiple 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
Apply AND and OR masks to the current contents of a holding register.
Modbus Communication Using the Modbus Explorer
- Use the Modbus Explorer App
You can read and write to coils and registers using the Modbus Explorer app.
- Configure a Connection in the Modbus Explorer
Configure communication with the device, either over TCP/IP or Serial RTU.
- Read Coils, Inputs, and Registers in the Modbus Explorer
Read coils, inputs, input registers, and holding registers, similar to the functionality of the Modbus
- Write to Coils and Holding Registers in the Modbus Explorer
Write to coils and holding registers, similar to the functionality of the Modbus
- Control a PLC Using the Modbus Explorer
Perform reads and writes to a PLC using the Modbus Explorer.
- Generate a Script from Your Modbus Explorer Session
Generate a MATLAB script from your session to run at the command line.
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.