Loadable Function: dev = modbus ('tcpip', deviceaddress)
Loadable Function: dev = modbus ('tcpip', deviceaddress, remoteport)
Loadable Function: dev = modbus ('tcpip', deviceaddress, name, value)
Loadable Function: dev = modbus ('serialrtu', serialport)
Loadable Function: dev = modbus ('serialrtu', serialport, name, value)

Open modbus interface using a specified transport of ’tcpip’ or ’serialrtu’.

Inputs

deviceaddress - the device ip address of type String.
remoteport - the device remote port number. If not specified, a default of 502 will be used.
name, value - Optional name value pairs for setting properties of the object.
serialport - the name of the serial port to connect to. It must be specified when transport is ’serialrtu’.

Common Input Name, Value pairs

Timeout

timeout value used for waiting for data

NumRetries

number of retries after a timeout

UserData

Additional data to attach to the object

Serial RTU Input Name, Value pairs

BaudRate

Baudrate for the serial port

DataBits

number of databits for serial port

Parity

Parity for serial port (’odd’, ’even’ or ’none’)

StopBits

number of stopbits for serial port

Outputs

The modbus() shall return instance of octave_modbus class as the result modbus.

Properties

The modbus object has the following public properties:

Name

name assigned to the modbus object

Type

instrument type ’modbus’ (readonly)

Port

Remote port number or serial port name (readonly)

DeviceAddress

Device address if transport was ’tcpip’ (readonly)

Status

status of the object ’open’ or ’closed’ (readonly)

Timeout

timeout value used for waiting for data

NumRetries

number of retries after a timeout

UserData

Additional data to attach to the object

Package: instrument-control