modbus
R2026bCreate Modbus interface object
Description
A Modbus® interface object represents a Modbus client in MATLAB® that connects to a Modbus server over TCP/IP or serial RTU protocols. Use this object to communicate with the server by reading or writing values to Modbus registers.
Creation
Syntax
Description
TCP/IP
creates a Modbus interface object, modbusClientObj = modbus("tcpip",deviceAddress)modbusClientObj, over the transport
type "tcpip". deviceAddress is the IP address or
host name of the Modbus server.
The function creates the interface object and immediately connects to the Modbus server. If the server is unreachable, the function returns an error. The interface specifies the default remote port for use by the Modbus server, port 502.
additionally specifies the remote port for the Modbus server.modbusClientObj = modbus("tcpip",deviceAddress,tcpipPort)
specifies TCP/IP transport
properties using optional name-value arguments.modbusClientObj = modbus(___,Name=Value)
Serial RTU
creates a Modbus interface object, modbusClientObj = modbus("serialrtu",serialPort)modbusClientObj, over the
transport type "serialrtu" using the specified
serialPort.
specifies Serial RTU
transport properties using optional name-value arguments.modbusClientObj = modbus(___,Name=Value)