主要内容

MODBUS Communication

Communication using the MODBUS interface

仪器控制工具箱™ 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.

使用该接口对象创建接口对象modbus功能,并使用,write,writeRead, 和maskWrite通信功能。

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

您还可以使用Modbus Explorer读写线圈和寄存器,该探索器提供图形用户界面以易于设置读取和写入,以及一个实时绘图以查看值。有关信息,请参阅Use the Modbus Explorer App. For an example that shows the entire workflow of reading and writing to a PLC using the app, seeControl a PLC Using the Modbus Explorer.

Functions

modbus Create MODBUS object
Read data from a MODBUS server
write 对连接的modbus服务器执行写操作
writeRead Perform a write then read operation on groups of holding registers in a single MODBUS transaction
maskWrite Perform mask write operation on a holding register
instrhwinfo Information about available hardware
清除 Remove instrument objects fromMATLABworkspace

Apps

Modbus Explorer Read and write to Modbus coils and registers

Topics

Modbus Communication Using Programmatic Workflow

MODBUS Interface Supported Features

仪器控制工具箱MODBUS support lets you communicate with MODBUS servers and applications over TCP/IP or Serial RTU.

Create a MODBUS Connection

To communicate over the MODBUS interface, you first create a MODBUS object using themodbus功能。创建对象也可以建立连接。

Configure Properties for MODBUS Communication

您可以使用属性在对象创建期间或任何时间设置Modbus通信。

Read Data from a MODBUS Server

You can read data from the MODBUS server connected to themodbus目的。You can read coils, inputs, input registers, and holding registers.

Read Temperature from a Remote Temperature Sensor

This example shows how to read temperature and humidity measurements from a remote sensor on a PLC connected via TCP/IP.

Write Data to a MODBUS Server

You can write data to the MODBUS server connected to themodbus目的。您可以写信给线圈并持有寄存器。

Write and Read Multiple Holding Registers

You can 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

您可以使用AN和面膜,或掩码和寄存器的当前内容的组合来修改保存寄存器的内容。

Modbus Communication Using the Modbus Explorer

Use the Modbus Explorer App

You can read and write to coils and registers in the Modbus Explorer app.

Configure a Connection in the Modbus Explorer

The first step in using the Modbus Explorer to communicate with a PLC or other Modbus device is to configure the communication with the device, either over TCP/IP or Serial RTU.

Read Coils, Inputs, and Registers in the Modbus Explorer

您可以在Modbus Explorer中读取线圈,输入,输入寄存器和持有寄存器。这是Modbus的功能功能。

Write to Coils and Holding Registers in the Modbus Explorer

You can write to coils and holding registers in the Modbus Explorer. This is the functionality of the Modbuswrite功能。

Control a PLC Using the Modbus Explorer

This example shows how to perform reads and writes to a PLC using the Modbus Explorer.

Generate a Script from Your Modbus Explorer Session

您可以从Modbus Explorer会话中生成MATLAB脚本,然后使用仪器控制工具箱Modbus功能在命令行中运行它。

Troubleshooting

故障排除modbus接口

如果您使用Modbus接口的工具箱遇到问题,请尝试这些提示。包括有关Modbus支持的平台,配置和连接以及其他特定于接口的提示的金宝app信息。