modbus_object.WriteMultipleCoils Method

Writes one or more outputs to a MODBUS slave.

modbus_object.WriteMultipleCoils(start, value_array)

Prerequisites

None

Parameters

start

A required Integer expression that specifies the number of the first coil to be written.

value_array

A required Boolean array that contains the output values to be written. The length of the array determines the number of coils written.

Remarks

This method issues a MODBUS/TCP Write Multiple Coils request (function 15). A new connection to the MODBUS slave is made if none currently exists. If any network errors occur, this method throws an exception.

Examples

Dim ep As New IPEndPoint("192.168.0.150")
Dim mb As New Modbus(ep)
Dim bool(15) As Boolean ' Array length is 16
bool(0) = True ' First output set, rest clear
mb.WriteMultipleCoils(1, bool) ' Write 16 outputs

See Also

Modbus Class |modbus_object.WriteSingleCoil