Instrument Control 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 humidly on a MODBUS probe.
Create the interface object using the
and use the
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.
|Create MODBUS object|
|Read data from a MODBUS server|
|Perform a write operation to the connected MODBUS server|
|Perform a write then read operation on groups of holding registers in a single MODBUS transaction|
|Perform mask write operation on a holding register|
|Information about available hardware|
|Remove instrument objects from MATLAB workspace|
Instrument Control Toolbox MODBUS support lets you communicate with MODBUS servers and applications over TCP/IP or Serial RTU.
To communicate over the MODBUS interface, you first
create a MODBUS object using the
Creating the object also makes the connection.
You can use properties to set up the MODBUS communication during object creation or any time.
You can read data from the MODBUS server connected
modbus object. You can read coils, inputs,
input registers, and holding registers.
This example shows how to read temperature and humidity measurements from a remote sensor on a PLC connected via TCP/IP.
You can write data to the MODBUS server connected
modbus object. You can write to coils and
You can perform a combination of one write operation and one read operation on groups of holding registers in a single MODBUS transaction.
You can modify the contents of a holding register using a combination of an AND mask, an OR mask, and the register's current contents.
Try these tips if you have problems using the toolbox with the MODBUS interface. Includes information about MODBUS supported platforms, configuration and connection, and other interface-specific tips.