Show / Hide Table of Contents

Interface IModbusMaster

Modbus master device.

Inherited Members
System.IDisposable.Dispose()
Namespace: NModbus
Assembly: NModbus.dll
Syntax
public interface IModbusMaster : IDisposable

Properties

| Improve this Doc View Source

Transport

Transport used by this master.

Declaration
IModbusTransport Transport { get; }
Property Value
Type Description
IModbusTransport

Methods

| Improve this Doc View Source

ExecuteCustomMessage<TResponse>(IModbusMessage)

Executes the custom message.

Declaration
TResponse ExecuteCustomMessage<TResponse>(IModbusMessage request)where TResponse : IModbusMessage, new ()
Parameters
Type Name Description
IModbusMessage request

The request.

Returns
Type Description
TResponse
Type Parameters
Name Description
TResponse

The type of the response.

| Improve this Doc View Source

ReadCoils(Byte, UInt16, UInt16)

Reads from 1 to 2000 contiguous coils status.

Declaration
bool[] ReadCoils(byte slaveAddress, ushort startAddress, ushort numberOfPoints)
Parameters
Type Name Description
System.Byte slaveAddress

Address of device to read values from.

System.UInt16 startAddress

Address to begin reading.

System.UInt16 numberOfPoints

Number of coils to read.

Returns
Type Description
System.Boolean[]

Coils status.

| Improve this Doc View Source

ReadCoilsAsync(Byte, UInt16, UInt16)

Asynchronously reads from 1 to 2000 contiguous coils status.

Declaration
Task<bool[]> ReadCoilsAsync(byte slaveAddress, ushort startAddress, ushort numberOfPoints)
Parameters
Type Name Description
System.Byte slaveAddress

Address of device to read values from.

System.UInt16 startAddress

Address to begin reading.

System.UInt16 numberOfPoints

Number of coils to read.

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean[]>

A task that represents the asynchronous read operation.

| Improve this Doc View Source

ReadHoldingRegisters(Byte, UInt16, UInt16)

Reads contiguous block of holding registers.

Declaration
ushort[] ReadHoldingRegisters(byte slaveAddress, ushort startAddress, ushort numberOfPoints)
Parameters
Type Name Description
System.Byte slaveAddress

Address of device to read values from.

System.UInt16 startAddress

Address to begin reading.

System.UInt16 numberOfPoints

Number of holding registers to read.

Returns
Type Description
System.UInt16[]

Holding registers status.

| Improve this Doc View Source

ReadHoldingRegistersAsync(Byte, UInt16, UInt16)

Asynchronously reads contiguous block of holding registers.

Declaration
Task<ushort[]> ReadHoldingRegistersAsync(byte slaveAddress, ushort startAddress, ushort numberOfPoints)
Parameters
Type Name Description
System.Byte slaveAddress

Address of device to read values from.

System.UInt16 startAddress

Address to begin reading.

System.UInt16 numberOfPoints

Number of holding registers to read.

Returns
Type Description
System.Threading.Tasks.Task<System.UInt16[]>

A task that represents the asynchronous read operation.

| Improve this Doc View Source

ReadInputRegisters(Byte, UInt16, UInt16)

Reads contiguous block of input registers.

Declaration
ushort[] ReadInputRegisters(byte slaveAddress, ushort startAddress, ushort numberOfPoints)
Parameters
Type Name Description
System.Byte slaveAddress

Address of device to read values from.

System.UInt16 startAddress

Address to begin reading.

System.UInt16 numberOfPoints

Number of holding registers to read.

Returns
Type Description
System.UInt16[]

Input registers status.

| Improve this Doc View Source

ReadInputRegistersAsync(Byte, UInt16, UInt16)

Asynchronously reads contiguous block of input registers.

Declaration
Task<ushort[]> ReadInputRegistersAsync(byte slaveAddress, ushort startAddress, ushort numberOfPoints)
Parameters
Type Name Description
System.Byte slaveAddress

Address of device to read values from.

System.UInt16 startAddress

Address to begin reading.

System.UInt16 numberOfPoints

Number of holding registers to read.

Returns
Type Description
System.Threading.Tasks.Task<System.UInt16[]>

A task that represents the asynchronous read operation.

| Improve this Doc View Source

ReadInputs(Byte, UInt16, UInt16)

Reads from 1 to 2000 contiguous discrete input status.

Declaration
bool[] ReadInputs(byte slaveAddress, ushort startAddress, ushort numberOfPoints)
Parameters
Type Name Description
System.Byte slaveAddress

Address of device to read values from.

System.UInt16 startAddress

Address to begin reading.

System.UInt16 numberOfPoints

Number of discrete inputs to read.

Returns
Type Description
System.Boolean[]

Discrete inputs status.

| Improve this Doc View Source

ReadInputsAsync(Byte, UInt16, UInt16)

Asynchronously reads from 1 to 2000 contiguous discrete input status.

Declaration
Task<bool[]> ReadInputsAsync(byte slaveAddress, ushort startAddress, ushort numberOfPoints)
Parameters
Type Name Description
System.Byte slaveAddress

Address of device to read values from.

System.UInt16 startAddress

Address to begin reading.

System.UInt16 numberOfPoints

Number of discrete inputs to read.

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean[]>

A task that represents the asynchronous read operation.

| Improve this Doc View Source

ReadWriteMultipleRegisters(Byte, UInt16, UInt16, UInt16, UInt16[])

Performs a combination of one read operation and one write operation in a single Modbus transaction. The write operation is performed before the read.

Declaration
ushort[] ReadWriteMultipleRegisters(byte slaveAddress, ushort startReadAddress, ushort numberOfPointsToRead, ushort startWriteAddress, ushort[] writeData)
Parameters
Type Name Description
System.Byte slaveAddress

Address of device to read values from.

System.UInt16 startReadAddress

Address to begin reading (Holding registers are addressed starting at 0).

System.UInt16 numberOfPointsToRead

Number of registers to read.

System.UInt16 startWriteAddress

Address to begin writing (Holding registers are addressed starting at 0).

System.UInt16[] writeData

Register values to write.

Returns
Type Description
System.UInt16[]
| Improve this Doc View Source

ReadWriteMultipleRegistersAsync(Byte, UInt16, UInt16, UInt16, UInt16[])

Asynchronously performs a combination of one read operation and one write operation in a single Modbus transaction. The write operation is performed before the read.

Declaration
Task<ushort[]> ReadWriteMultipleRegistersAsync(byte slaveAddress, ushort startReadAddress, ushort numberOfPointsToRead, ushort startWriteAddress, ushort[] writeData)
Parameters
Type Name Description
System.Byte slaveAddress

Address of device to read values from.

System.UInt16 startReadAddress

Address to begin reading (Holding registers are addressed starting at 0).

System.UInt16 numberOfPointsToRead

Number of registers to read.

System.UInt16 startWriteAddress

Address to begin writing (Holding registers are addressed starting at 0).

System.UInt16[] writeData

Register values to write.

Returns
Type Description
System.Threading.Tasks.Task<System.UInt16[]>

A task that represents the asynchronous operation

| Improve this Doc View Source

WriteMultipleCoils(Byte, UInt16, Boolean[])

Writes a sequence of coils.

Declaration
void WriteMultipleCoils(byte slaveAddress, ushort startAddress, bool[] data)
Parameters
Type Name Description
System.Byte slaveAddress

Address of the device to write to.

System.UInt16 startAddress

Address to begin writing values.

System.Boolean[] data

Values to write.

| Improve this Doc View Source

WriteMultipleCoilsAsync(Byte, UInt16, Boolean[])

Asynchronously writes a sequence of coils.

Declaration
Task WriteMultipleCoilsAsync(byte slaveAddress, ushort startAddress, bool[] data)
Parameters
Type Name Description
System.Byte slaveAddress

Address of the device to write to.

System.UInt16 startAddress

Address to begin writing values.

System.Boolean[] data

Values to write.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the asynchronous write operation.

| Improve this Doc View Source

WriteMultipleRegisters(Byte, UInt16, UInt16[])

Writes a block of 1 to 123 contiguous registers.

Declaration
void WriteMultipleRegisters(byte slaveAddress, ushort startAddress, ushort[] data)
Parameters
Type Name Description
System.Byte slaveAddress

Address of the device to write to.

System.UInt16 startAddress

Address to begin writing values.

System.UInt16[] data

Values to write.

| Improve this Doc View Source

WriteMultipleRegistersAsync(Byte, UInt16, UInt16[])

Asynchronously writes a block of 1 to 123 contiguous registers.

Declaration
Task WriteMultipleRegistersAsync(byte slaveAddress, ushort startAddress, ushort[] data)
Parameters
Type Name Description
System.Byte slaveAddress

Address of the device to write to.

System.UInt16 startAddress

Address to begin writing values.

System.UInt16[] data

Values to write.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the asynchronous write operation.

| Improve this Doc View Source

WriteSingleCoil(Byte, UInt16, Boolean)

Writes a single coil value.

Declaration
void WriteSingleCoil(byte slaveAddress, ushort coilAddress, bool value)
Parameters
Type Name Description
System.Byte slaveAddress

Address of the device to write to.

System.UInt16 coilAddress

Address to write value to.

System.Boolean value

Value to write.

| Improve this Doc View Source

WriteSingleCoilAsync(Byte, UInt16, Boolean)

Asynchronously writes a single coil value.

Declaration
Task WriteSingleCoilAsync(byte slaveAddress, ushort coilAddress, bool value)
Parameters
Type Name Description
System.Byte slaveAddress

Address of the device to write to.

System.UInt16 coilAddress

Address to write value to.

System.Boolean value

Value to write.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the asynchronous write operation.

| Improve this Doc View Source

WriteSingleRegister(Byte, UInt16, UInt16)

Writes a single holding register.

Declaration
void WriteSingleRegister(byte slaveAddress, ushort registerAddress, ushort value)
Parameters
Type Name Description
System.Byte slaveAddress

Address of the device to write to.

System.UInt16 registerAddress

Address to write.

System.UInt16 value

Value to write.

| Improve this Doc View Source

WriteSingleRegisterAsync(Byte, UInt16, UInt16)

Asynchronously writes a single holding register.

Declaration
Task WriteSingleRegisterAsync(byte slaveAddress, ushort registerAddress, ushort value)
Parameters
Type Name Description
System.Byte slaveAddress

Address of the device to write to.

System.UInt16 registerAddress

Address to write.

System.UInt16 value

Value to write.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the asynchronous write operation.

Extension Methods

EnronModbus.ReadHoldingRegisters32(IModbusMaster, Byte, UInt16, UInt16)
EnronModbus.ReadInputRegisters32(IModbusMaster, Byte, UInt16, UInt16)
EnronModbus.WriteSingleRegister32(IModbusMaster, Byte, UInt16, UInt32)
EnronModbus.WriteMultipleRegisters32(IModbusMaster, Byte, UInt16, UInt32[])
  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX