Modbus Class

The Modbus Class in GPL supports master access to MODBUS/TCP slave devices connected to the local Ethernet.

Table 19-48 summarizes the methods and properties of the class.

Table 19-48: Modbus Class Definitions

Modbus Class Member Type Description

New Modbus

Constructor Method

Creates an object for a MODBUS connection and specifies the IP address.

modbus_object.Close

Method

Closes any connections associated with this object.

modbus_object.ReadCoils

Method

Reads one or more outputs.

modbus_object.ReadDeviceId

Method

Reads the device ID strings.

modbus_object.ReadDiscreteInputs

Method

Reads one or more inputs.

modbus_object.ReadHoldingRegisters

Method

Reads one or more holding registers.

modbus_object.ReadInputRegisters

Method

Reads one or more input registers.

modbus_object.Timeout

Get/Set Property

Gets or sets the timeout, in milliseconds, that this connection will wait for a reply before throwing an exception.

modbus_object.WriteMultipleCoils

Method

Writes multiple outputs.

modbus_object.WriteMultipleRegisters

Method

Writes multiple holding registers.

modbus_object.WriteSingleCoil

Method

Writes a single output.

modbus_object.WriteSingleRegister

Method

Writes a single holding register.