You are on page 1of 323

NModbus FtdAdapter Namespace

Namespaces ► FtdAdapter C#

.NET wrapper for Future Device Technologies USB driver. This assembly
contains unsafe code and must be run with full trust.

Declaration Syntax
C# Visual Basic Visual C++
namespace FtdAdapter

Namespace FtdAdapter

namespace FtdAdapter

Types
All Types Classes Structures Enumerations
Icon Type Description
FtdDeviceInfo Provides information about an attached
FTDI USB device.

FtdFlowControl Specifies the flow control used on the


UsbPort object.

FtdParity Specifies the parity used on the UsbPort


object.

FtdStopBits Specifies the number of stop bits used on


the UsbPort object.

FtdUsbPort Wrapper class for the FTD2XX USB


resource.
NModbus FtdDeviceInfo Structure
Namespaces ► FtdAdapter ► FtdDeviceInfo C#

Provides information about an attached FTDI USB device.

Declaration Syntax
C# Visual Basic Visual C++
public struct FtdDeviceInfo

Public Structure FtdDeviceInfo

public value class FtdDeviceInfo

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
Description Description of device.

Equality(FtdDeviceInfo, Implements the operator ==.


FtdDeviceInfo)

Equals(Object) Indicates whether this instance and a


specified object are equal.

(Overrides ValueType.Equals(Object).)
Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is reclaimed
by garbage collection.

(Inherited from Object.)


Flags Device flags.
GetHashCode() Returns the hash code for this instance.

(Overrides ValueType.GetHashCode().)
GetType() Gets the Type of the current instance.

(Inherited from Object.)


Id Complete device ID, comprising Vendor
ID and Product ID.

Inequality(FtdDeviceInfo, Implements the operator !=.


FtdDeviceInfo)

IsOpen Gets a value indicating if the device is


already open.

LocationId LocID

MemberwiseClone() Creates a shallow copy of the current


Object.

(Inherited from Object.)


ProductId Product ID

SerialNumber Serial number of device.

ToString() Returns the fully qualified type name of


this instance.

(Inherited from ValueType.)


Type Device type.

VendorId Vendor ID.


Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)
NModbus Description Property
Namespaces ► FtdAdapter ► FtdDeviceInfo ► Description C#

Description of device.

Declaration Syntax
C# Visual Basic Visual C++
public string Description { get; }

Public ReadOnly Property Description As String

public:
property String^ Description {
String^ get ();
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Equality Operator
Namespaces ► FtdAdapter ► FtdDeviceInfo ► Equality(FtdDeviceInfo,
FtdDeviceInfo)
C#
Implements the operator ==.

Declaration Syntax
C# Visual Basic Visual C++
public static bool operator ==(
FtdDeviceInfo left,
FtdDeviceInfo right
)

Public Shared Operator = ( _


left As FtdDeviceInfo, _
right As FtdDeviceInfo _
) As Boolean

public:
static bool operator ==(
FtdDeviceInfo left,
FtdDeviceInfo right
)

Parameters
left (FtdDeviceInfo)
The left.
right (FtdDeviceInfo)
The right.

Return Value
The result of the operator.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Equals Method (obj)
Namespaces ► FtdAdapter ► FtdDeviceInfo ► Equals(Object) C#

Indicates whether this instance and a specified object are equal.

Declaration Syntax
C# Visual Basic Visual C++
public override bool Equals(
Object obj
)

Public Overrides Function Equals ( _


obj As Object _
) As Boolean

public:
virtual bool Equals(
Object^ obj
) override

Parameters
obj (Object)
Another object to compare to.

Return Value
true if obj and this instance are the same type and represent the same value;
otherwise, false.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Flags Property
Namespaces ► FtdAdapter ► FtdDeviceInfo ► Flags C#

Device flags.

Declaration Syntax
C# Visual Basic Visual C++
public uint Flags { get; }

Public ReadOnly Property Flags As UInteger

public:
property unsigned int Flags {
unsigned int get ();
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus GetHashCode Method
Namespaces ► FtdAdapter ► FtdDeviceInfo ► GetHashCode() C#

Returns the hash code for this instance.

Declaration Syntax
C# Visual Basic Visual C++
public override int GetHashCode()

Public Overrides Function GetHashCode As Integer

public:
virtual int GetHashCode() override

Return Value
A 32-bit signed integer that is the hash code for this instance.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Id Property
Namespaces ► FtdAdapter ► FtdDeviceInfo ► Id C#

Complete device ID, comprising Vendor ID and Product ID.

Declaration Syntax
C# Visual Basic Visual C++
public uint Id { get; }

Public ReadOnly Property Id As UInteger

public:
property unsigned int Id {
unsigned int get ();
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Inequality Operator
Namespaces ► FtdAdapter ► FtdDeviceInfo ► Inequality(FtdDeviceInfo,
FtdDeviceInfo)
C#
Implements the operator !=.

Declaration Syntax
C# Visual Basic Visual C++
public static bool operator !=(
FtdDeviceInfo left,
FtdDeviceInfo right
)

Public Shared Operator <> ( _


left As FtdDeviceInfo, _
right As FtdDeviceInfo _
) As Boolean

public:
static bool operator !=(
FtdDeviceInfo left,
FtdDeviceInfo right
)

Parameters
left (FtdDeviceInfo)
The left.
right (FtdDeviceInfo)
The right.

Return Value
The result of the operator.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus IsOpen Property
Namespaces ► FtdAdapter ► FtdDeviceInfo ► IsOpen C#

Gets a value indicating if the device is already open.

Declaration Syntax
C# Visual Basic Visual C++
public bool IsOpen { get; }

Public ReadOnly Property IsOpen As Boolean

public:
property bool IsOpen {
bool get ();
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus LocationId Property
Namespaces ► FtdAdapter ► FtdDeviceInfo ► LocationId C#

LocID

Declaration Syntax
C# Visual Basic Visual C++
public uint LocationId { get; }

Public ReadOnly Property LocationId As UInteger

public:
property unsigned int LocationId {
unsigned int get ();
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus ProductId Property
Namespaces ► FtdAdapter ► FtdDeviceInfo ► ProductId C#

Product ID

Declaration Syntax
C# Visual Basic Visual C++
public uint ProductId { get; }

Public ReadOnly Property ProductId As UInteger

public:
property unsigned int ProductId {
unsigned int get ();
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus SerialNumber Property
Namespaces ► FtdAdapter ► FtdDeviceInfo ► SerialNumber C#

Serial number of device.

Declaration Syntax
C# Visual Basic Visual C++
public string SerialNumber { get; }

Public ReadOnly Property SerialNumber As String

public:
property String^ SerialNumber {
String^ get ();
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Type Property
Namespaces ► FtdAdapter ► FtdDeviceInfo ► Type C#

Device type.

Declaration Syntax
C# Visual Basic Visual C++
public uint Type { get; }

Public ReadOnly Property Type As UInteger

public:
property unsigned int Type {
unsigned int get ();
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus VendorId Property
Namespaces ► FtdAdapter ► FtdDeviceInfo ► VendorId C#

Vendor ID.

Declaration Syntax
C# Visual Basic Visual C++
public uint VendorId { get; }

Public ReadOnly Property VendorId As UInteger

public:
property unsigned int VendorId {
unsigned int get ();
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus FtdFlowControl Enumeration
Namespaces ► FtdAdapter ► FtdFlowControl C#

Specifies the flow control used on the UsbPort object.

Declaration Syntax
C# Visual Basic Visual C++
public enum FtdFlowControl

Public Enumeration FtdFlowControl

public enum class FtdFlowControl

Members
Member Description
None No flow control is used

RtsCts RTS CTS are used for flow control

DtrDsr DTR DSR are used for flow control

XonXoff XON XOFF are used for flow control

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus FtdParity Enumeration
Namespaces ► FtdAdapter ► FtdParity C#

Specifies the parity used on the UsbPort object.

Declaration Syntax
C# Visual Basic Visual C++
public enum FtdParity

Public Enumeration FtdParity

public enum class FtdParity

Members
Member Description
None No parity check occurs.

Odd Sets the parity bit so that the count of bits set
is an odd number.

Even Sets the parity bit so that the count of bits set
is an even number.

Mark Leaves the parity bit set to 1.

Space Leaves the parity bit set to 0.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus FtdStopBits Enumeration
Namespaces ► FtdAdapter ► FtdStopBits C#

Specifies the number of stop bits used on the UsbPort object.

Declaration Syntax
C# Visual Basic Visual C++
public enum FtdStopBits

Public Enumeration FtdStopBits

public enum class FtdStopBits

Members
Member Description
One One stop bit is used.

OnePointFive 1.5 stop bits are used.

Two Two stop bits are used.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus FtdUsbPort Class
Namespaces ► FtdAdapter ► FtdUsbPort C#

Wrapper class for the FTD2XX USB resource.

Declaration Syntax
C# Visual Basic Visual C++
public class FtdUsbPort : IStreamResource, IDisposable

Public Class FtdUsbPort _


Implements IStreamResource, IDisposable

public ref class FtdUsbPort : IStreamResource,


IDisposable

Members
All Members Constructors Methods Properties

Public Instance Declared


Protected Static
Inherited
Icon Member Description
FtdUsbPort() Initializes a new instance of the
FtdUsbPort class.

BaudRate Gets or sets the serial baud rate.

Close() Closes the port connection.

DataBits Gets or sets the standard length of


data bits per byte.

DiscardInBuffer() Purges the receive buffer.


Dispose() Performs application-defined tasks
associated with freeing, releasing, or
resetting unmanaged resources.

Dispose(Boolean) Releases unmanaged and - optionally -


managed resources

Equals(Object) Determines whether the specified


Object is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is
reclaimed by garbage collection.

(Inherited from Object.)


GetDeviceCount() Returns the number of D2XX devices
connected to the system.

GetDeviceInfo(UInt32) Gets the device info at the specified


device index.

GetDeviceInfos() Gets an array of the currently


connected device's device info.

GetHashCode() Serves as a hash function for a


particular type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


InfiniteTimeout Indicates that no time-out should
occur.

IsOpen Gets a value indicating the open or


closed status of the UsbPort object.

MemberwiseClone() Creates a shallow copy of the current


Object.

(Inherited from Object.)


OpenByDescription(String) Opens the device by description.

OpenByIndex(UInt32) Opens the device by index.

OpenByLocationId(UInt32) Opens the device by location id.

OpenBySerialNumber(String) Opens the device by serial number.

Parity Gets or sets the parity-checking


protocol.

Read(Byte[], Int32, Int32) Reads a number of bytes from the


UsbPort input buffer and writes those
bytes into a byte array at the specified
offset.

ReadTimeout Gets or sets the number of


milliseconds before a time-out occurs
when a read operation does not finish.
SetFlowControl(FtdFlowControl, Set flow control.
Byte, Byte)

StopBits Gets or sets the standard number of


stopbits per byte.

ToString() Returns a String that represents the


current Object.

(Inherited from Object.)


Write(Byte[], Int32, Int32) Writes a specified number of bytes to
the port from an output buffer, starting
at the specified offset.

WriteTimeout Gets or sets the number of


milliseconds before a time-out occurs
when a write operation does not finish.

Inheritance Hierarchy
Object
FtdUsbPort

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus FtdUsbPort Constructor
Namespaces ► FtdAdapter ► FtdUsbPort ► FtdUsbPort() C#

Initializes a new instance of the FtdUsbPort class.

Declaration Syntax
C# Visual Basic Visual C++
public FtdUsbPort()

Public Sub New

public:
FtdUsbPort()

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus BaudRate Property
Namespaces ► FtdAdapter ► FtdUsbPort ► BaudRate C#

Gets or sets the serial baud rate.

Declaration Syntax
C# Visual Basic Visual C++
public int BaudRate { get; set; }

Public Property BaudRate As Integer

public:
property int BaudRate {
int get ();
void set (int value);
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Close Method
Namespaces ► FtdAdapter ► FtdUsbPort ► Close() C#

Closes the port connection.

Declaration Syntax
C# Visual Basic Visual C++
public void Close()

Public Sub Close

public:
void Close()

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus DataBits Property
Namespaces ► FtdAdapter ► FtdUsbPort ► DataBits C#

Gets or sets the standard length of data bits per byte.

Declaration Syntax
C# Visual Basic Visual C++
public int DataBits { get; set; }

Public Property DataBits As Integer

public:
property int DataBits {
int get ();
void set (int value);
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus DiscardInBuffer Method
Namespaces ► FtdAdapter ► FtdUsbPort ► DiscardInBuffer() C#

Purges the receive buffer.

Declaration Syntax
C# Visual Basic Visual C++
public void DiscardInBuffer()

Public Sub DiscardInBuffer

public:
virtual void DiscardInBuffer() sealed

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Dispose Method
Namespaces ► FtdAdapter ► FtdUsbPort ► Dispose() C#

Members
Icon Member Description
Dispose() Performs application-defined tasks
associated with freeing, releasing, or
resetting unmanaged resources.

Dispose(Boolean) Releases unmanaged and - optionally -


managed resources

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Dispose Method
Namespaces ► FtdAdapter ► FtdUsbPort ► Dispose() C#

Performs application-defined tasks associated with freeing, releasing, or


resetting unmanaged resources.

Declaration Syntax
C# Visual Basic Visual C++
public void Dispose()

Public Sub Dispose

public:
virtual void Dispose() sealed

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Dispose Method (disposing)
Namespaces ► FtdAdapter ► FtdUsbPort ► Dispose(Boolean) C#

Releases unmanaged and - optionally - managed resources

Declaration Syntax
C# Visual Basic Visual C++
protected virtual void Dispose(
bool disposing
)

Protected Overridable Sub Dispose ( _


disposing As Boolean _
)

protected:
virtual void Dispose(
bool disposing
)

Parameters
disposing (Boolean)
true to release both managed and unmanaged resources; false to
release only unmanaged resources.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus GetDeviceCount Method
Namespaces ► FtdAdapter ► FtdUsbPort ► GetDeviceCount() C#

Returns the number of D2XX devices connected to the system.

Declaration Syntax
C# Visual Basic Visual C++
public static int GetDeviceCount()

Public Shared Function GetDeviceCount As Integer

public:
static int GetDeviceCount()

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus GetDeviceInfo Method (index)
Namespaces ► FtdAdapter ► FtdUsbPort ► GetDeviceInfo(UInt32)
C#
Gets the device info at the specified device index.

Declaration Syntax
C# Visual Basic Visual C++
public static FtdDeviceInfo GetDeviceInfo(
uint index
)

Public Shared Function GetDeviceInfo ( _


index As UInteger _
) As FtdDeviceInfo

public:
static FtdDeviceInfo GetDeviceInfo(
unsigned int index
)

Parameters
index (UInt32)
Index of the device.

Return Value
An FtdDeviceInfo instance.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus GetDeviceInfos Method
Namespaces ► FtdAdapter ► FtdUsbPort ► GetDeviceInfos() C#

Gets an array of the currently connected device's device info.

Declaration Syntax
C# Visual Basic Visual C++
public static FtdDeviceInfo[] GetDeviceInfos()

Public Shared Function GetDeviceInfos As FtdDeviceInfo()

public:
static array<FtdDeviceInfo>^ GetDeviceInfos()

Return Value
An array of FtdDeviceInfo objects.

Exceptions
Exception Condition
IOException

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus InfiniteTimeout Property
Namespaces ► FtdAdapter ► FtdUsbPort ► InfiniteTimeout C#

Indicates that no time-out should occur.

Declaration Syntax
C# Visual Basic Visual C++
public int InfiniteTimeout { get; }

Public ReadOnly Property InfiniteTimeout As Integer

public:
virtual property int InfiniteTimeout {
int get () sealed;
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus IsOpen Property
Namespaces ► FtdAdapter ► FtdUsbPort ► IsOpen C#

Gets a value indicating the open or closed status of the UsbPort object.

Declaration Syntax
C# Visual Basic Visual C++
public bool IsOpen { get; }

Public ReadOnly Property IsOpen As Boolean

public:
property bool IsOpen {
bool get ();
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus OpenByDescription Method (description)
Namespaces ► FtdAdapter ► FtdUsbPort ► OpenByDescription(String)
C#
Opens the device by description.

Declaration Syntax
C# Visual Basic Visual C++
public void OpenByDescription(
string description
)

Public Sub OpenByDescription ( _


description As String _
)

public:
void OpenByDescription(
String^ description
)

Parameters
description (String)
The description.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus OpenByIndex Method (index)
Namespaces ► FtdAdapter ► FtdUsbPort ► OpenByIndex(UInt32)
C#
Opens the device by index.

Declaration Syntax
C# Visual Basic Visual C++
public void OpenByIndex(
uint index
)

Public Sub OpenByIndex ( _


index As UInteger _
)

public:
void OpenByIndex(
unsigned int index
)

Parameters
index (UInt32)
Must be 0 if only one device is attached. For multiple devices 1, 2 etc.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus OpenByLocationId Method (locationId)
Namespaces ► FtdAdapter ► FtdUsbPort ► OpenByLocationId(UInt32)
C#
Opens the device by location id.

Declaration Syntax
C# Visual Basic Visual C++
public void OpenByLocationId(
uint locationId
)

Public Sub OpenByLocationId ( _


locationId As UInteger _
)

public:
void OpenByLocationId(
unsigned int locationId
)

Parameters
locationId (UInt32)
The location id.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus OpenBySerialNumber Method (serialNumber)
Namespaces ► FtdAdapter ► FtdUsbPort ► OpenBySerialNumber(String)
C#
Opens the device by serial number.

Declaration Syntax
C# Visual Basic Visual C++
public void OpenBySerialNumber(
string serialNumber
)

Public Sub OpenBySerialNumber ( _


serialNumber As String _
)

public:
void OpenBySerialNumber(
String^ serialNumber
)

Parameters
serialNumber (String)
The serial number.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Parity Property
Namespaces ► FtdAdapter ► FtdUsbPort ► Parity C#

Gets or sets the parity-checking protocol.

Declaration Syntax
C# Visual Basic Visual C++
public FtdParity Parity { get; set; }

Public Property Parity As FtdParity

public:
property FtdParity Parity {
FtdParity get ();
void set (FtdParity value);
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Read Method (buffer, offset, count)
Namespaces ► FtdAdapter ► FtdUsbPort ► Read(Byte[], Int32, Int32)
C#
Reads a number of bytes from the UsbPort input buffer and writes those bytes
into a byte array at the specified offset.

Declaration Syntax
C# Visual Basic Visual C++
public int Read(
byte[] buffer,
int offset,
int count
)

Public Function Read ( _


buffer As Byte(), _
offset As Integer, _
count As Integer _
) As Integer

public:
virtual int Read(
array<unsigned char>^ buffer,
int offset,
int count
) sealed

Parameters
buffer ( Byte [])
The byte array to write the input to.
offset (Int32)
The offset in the buffer array to begin writing.
count (Int32)
The number of bytes to read.

Return Value
The number of bytes read.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus ReadTimeout Property
Namespaces ► FtdAdapter ► FtdUsbPort ► ReadTimeout C#

Gets or sets the number of milliseconds before a time-out occurs when a read
operation does not finish.

Declaration Syntax
C# Visual Basic Visual C++
public int ReadTimeout { get; set; }

Public Property ReadTimeout As Integer

public:
virtual property int ReadTimeout {
int get () sealed;
void set (int value) sealed;
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


SetFlowControl Method (flowControl, xOn,
NModbus

xOff)
Namespaces ► FtdAdapter ► FtdUsbPort ►
SetFlowControl(FtdFlowControl, Byte, Byte)
C#
Set flow control.

Declaration Syntax
C# Visual Basic Visual C++
public void SetFlowControl(
FtdFlowControl flowControl,
byte xOn,
byte xOff
)

Public Sub SetFlowControl ( _


flowControl As FtdFlowControl, _
xOn As Byte, _
xOff As Byte _
)

public:
void SetFlowControl(
FtdFlowControl flowControl,
unsigned char xOn,
unsigned char xOff
)

Parameters
flowControl (FtdFlowControl)
Type of flow control
xOn (Byte)
XON symbol
xOff (Byte)
XOFF symbol

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus StopBits Property
Namespaces ► FtdAdapter ► FtdUsbPort ► StopBits C#

Gets or sets the standard number of stopbits per byte.

Declaration Syntax
C# Visual Basic Visual C++
public FtdStopBits StopBits { get; set; }

Public Property StopBits As FtdStopBits

public:
property FtdStopBits StopBits {
FtdStopBits get ();
void set (FtdStopBits value);
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Write Method (buffer, offset, count)
Namespaces ► FtdAdapter ► FtdUsbPort ► Write(Byte[], Int32, Int32)
C#
Writes a specified number of bytes to the port from an output buffer, starting
at the specified offset.

Declaration Syntax
C# Visual Basic Visual C++
public void Write(
byte[] buffer,
int offset,
int count
)

Public Sub Write ( _


buffer As Byte(), _
offset As Integer, _
count As Integer _
)

public:
virtual void Write(
array<unsigned char>^ buffer,
int offset,
int count
) sealed

Parameters
buffer ( Byte [])
The byte array that contains the data to write to the port.
offset (Int32)
The offset in the buffer array to begin writing.
count (Int32)
The number of bytes to write.

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus WriteTimeout Property
Namespaces ► FtdAdapter ► FtdUsbPort ► WriteTimeout C#

Gets or sets the number of milliseconds before a time-out occurs when a write
operation does not finish.

Declaration Syntax
C# Visual Basic Visual C++
public int WriteTimeout { get; set; }

Public Property WriteTimeout As Integer

public:
virtual property int WriteTimeout {
int get () sealed;
void set (int value) sealed;
}

Assembly: FtdAdapter (Module: FtdAdapter) Version: 1.11.0.0 (1.11.0.0)


NModbus Modbus Namespace
Namespaces ► Modbus C#

Modbus.

Declaration Syntax
C# Visual Basic Visual C++
namespace Modbus

Namespace Modbus

namespace Modbus

Types
All Types Classes
Icon Type Description
SlaveException Represents slave errors that occur during
communication.
NModbus SlaveException Class
Namespaces ► Modbus ► SlaveException C#

Represents slave errors that occur during communication.

Declaration Syntax
C# Visual Basic Visual C++
[SerializableAttribute]
public class SlaveException : Exception

<SerializableAttribute> _
Public Class SlaveException _
Inherits Exception

[SerializableAttribute]
public ref class SlaveException : public Exception

Members
All Members Constructors Methods Properties

Public Instance Declared


Protected Static
Inherited
Icon Member Description
SlaveException() Initializes a new instance of the
SlaveException class.

SlaveException(String) Initializes a new instance of the


SlaveException class.

SlaveException(String, Initializes a new instance of the


Exception) SlaveException class.

SlaveException(SerializationInfo, Initializes a new instance of the


StreamingContext) SlaveException class.
Data Gets a collection of key/value pairs th
provide additional user-defined
information about the exception.

(Inherited from Exception.)


Equals(Object) Determines whether the specified Obj
equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is reclaim
by garbage collection.

(Inherited from Object.)


FunctionCode Gets the response function code that
caused the exception to occur, or 0.

GetBaseException() When overridden in a derived class,


returns the Exception that is the root
cause of one or more subsequent
exceptions.

(Inherited from Exception.)


GetHashCode() Serves as a hash function for a partic
type.

(Inherited from Object.)


GetObjectData(SerializationInfo, When overridden in a derived class, s
StreamingContext) the SerializationInfo with information
about the exception.

(Overrides
Exception.GetObjectData(Serializatio
StreamingContext).)
GetType() Gets the runtime type of the current
instance.
(Inherited from Exception.)

HelpLink Gets or sets a link to the help file


associated with this exception.

(Inherited from Exception.)


HResult Gets or sets HRESULT, a coded numer
value that is assigned to a specific
exception.

(Inherited from Exception.)


InnerException Gets the Exception instance that caus
the current exception.

(Inherited from Exception.)


MemberwiseClone() Creates a shallow copy of the current
Object.

(Inherited from Object.)


Message Gets a message that describes the cu
exception.

(Overrides Exception.Message.)
SlaveAddress Gets the slave address, or 0.

SlaveExceptionCode Gets the slave exception code, or 0.

Source Gets or sets the name of the applicati


the object that causes the error.

(Inherited from Exception.)


StackTrace Gets a string representation of the fra
on the call stack at the time the curre
exception was thrown.

(Inherited from Exception.)


TargetSite Gets the method that throws the curr
exception.

(Inherited from Exception.)


ToString() Creates and returns a string
representation of the current exceptio

(Inherited from Exception.)

Inheritance Hierarchy
Object
Exception
SlaveException

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus SlaveException Constructor
Namespaces ► Modbus ► SlaveException ► SlaveException() C#

Members
Icon Member Description
SlaveException() Initializes a new instance of the
SlaveException class.

SlaveException(String) Initializes a new instance of the


SlaveException class.

SlaveException(String, Initializes a new instance of the


Exception) SlaveException class.

SlaveException(SerializationInfo, Initializes a new instance of the


StreamingContext) SlaveException class.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus SlaveException Constructor
Namespaces ► Modbus ► SlaveException ► SlaveException() C#

Initializes a new instance of the SlaveException class.

Declaration Syntax
C# Visual Basic Visual C++
public SlaveException()

Public Sub New

public:
SlaveException()

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus SlaveException Constructor (info, context)
Namespaces ► Modbus ► SlaveException ►
SlaveException(SerializationInfo, StreamingContext)
C#
Initializes a new instance of the SlaveException class.

Declaration Syntax
C# Visual Basic Visual C++
protected SlaveException(
SerializationInfo info,
StreamingContext context
)

Protected Sub New ( _


info As SerializationInfo, _
context As StreamingContext _
)

protected:
SlaveException(
SerializationInfo^ info,
StreamingContext context
)

Parameters
info (SerializationInfo)
The SerializationInfo that holds the serialized object data about the
exception being thrown.
context (StreamingContext)
The StreamingContext that contains contextual information about the
source or destination.

Exceptions
Exception Condition
SerializationException The class name is null or HResult is zero (0).
ArgumentNullException The info parameter is null.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus SlaveException Constructor (message)
Namespaces ► Modbus ► SlaveException ► SlaveException(String)
C#
Initializes a new instance of the SlaveException class.

Declaration Syntax
C# Visual Basic Visual C++
public SlaveException(
string message
)

Public Sub New ( _


message As String _
)

public:
SlaveException(
String^ message
)

Parameters
message (String)
The message.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


SlaveException Constructor (message,
NModbus

innerException)
Namespaces ► Modbus ► SlaveException ► SlaveException(String,
Exception)
C#
Initializes a new instance of the SlaveException class.

Declaration Syntax
C# Visual Basic Visual C++
public SlaveException(
string message,
Exception innerException
)

Public Sub New ( _


message As String, _
innerException As Exception _
)

public:
SlaveException(
String^ message,
Exception^ innerException
)

Parameters
message (String)
The message.
innerException (Exception)
The inner exception.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus FunctionCode Property
Namespaces ► Modbus ► SlaveException ► FunctionCode C#

Gets the response function code that caused the exception to occur, or 0.

Declaration Syntax
C# Visual Basic Visual C++
public byte FunctionCode { get; }

Public ReadOnly Property FunctionCode As Byte

public:
property unsigned char FunctionCode {
unsigned char get ();
}

Value
The function code.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus GetObjectData Method (info, context)
Namespaces ► Modbus ► SlaveException ►
GetObjectData(SerializationInfo, StreamingContext)
C#
When overridden in a derived class, sets the SerializationInfo with information
about the exception.

Declaration Syntax
C# Visual Basic Visual C++
public override void GetObjectData(
SerializationInfo info,
StreamingContext context
)

Public Overrides Sub GetObjectData ( _


info As SerializationInfo, _
context As StreamingContext _
)

public:
virtual void GetObjectData(
SerializationInfo^ info,
StreamingContext context
) override

Parameters
info (SerializationInfo)
The SerializationInfo that holds the serialized object data about the
exception being thrown.
context (StreamingContext)
The StreamingContext that contains contextual information about the
source or destination.

Exceptions
Exception Condition
ArgumentNullException The info parameter is a null reference
(Nothing in Visual Basic).
Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)
NModbus Message Property
Namespaces ► Modbus ► SlaveException ► Message C#

Gets a message that describes the current exception.

Declaration Syntax
C# Visual Basic Visual C++
public override string Message { get; }

Public Overrides ReadOnly Property Message As String

public:
virtual property String^ Message {
String^ get () override;
}

Value
Return Value
The error message that explains the reason for the exception, or an empty
string("").

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus SlaveAddress Property
Namespaces ► Modbus ► SlaveException ► SlaveAddress C#

Gets the slave address, or 0.

Declaration Syntax
C# Visual Basic Visual C++
public byte SlaveAddress { get; }

Public ReadOnly Property SlaveAddress As Byte

public:
property unsigned char SlaveAddress {
unsigned char get ();
}

Value
The slave address.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus SlaveExceptionCode Property
Namespaces ► Modbus ► SlaveException ► SlaveExceptionCode
C#
Gets the slave exception code, or 0.

Declaration Syntax
C# Visual Basic Visual C++
public byte SlaveExceptionCode { get; }

Public ReadOnly Property SlaveExceptionCode As Byte

public:
property unsigned char SlaveExceptionCode {
unsigned char get ();
}

Value
The slave exception code.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Modbus.Data Namespace
Namespaces ► Modbus.Data C#

Modbus data.

Declaration Syntax
C# Visual Basic Visual C++
namespace Modbus.Data

Namespace Modbus.Data

namespace Modbus.Data

Types
All Types Classes Interfaces Enumerations
Icon Type Description
DataStore Object simulation of device
memory map. The underlying
collections are thread safe when
using the ModbusMaster API to
read/write values. You can use the
SyncRoot property to synchronize
direct access to the DataStore
collections.

DataStoreEventArgs Event args for read write actions


performed on the DataStore.

DataStoreFactory Data story factory.

DiscreteCollection Collection of discrete values.

IModbusMessageDataCollection Modbus message containing data.


ModbusDataCollection<TData> A 1 origin collection represetative
of the Modbus Data Model.

ModbusDataType Types of data supported by the


Modbus protocol.

RegisterCollection Collection of 16 bit registers.


NModbus DataStore Class
Namespaces ► Modbus.Data ► DataStore C#

Object simulation of device memory map. The underlying collections are


thread safe when using the ModbusMaster API to read/write values. You can
use the SyncRoot property to synchronize direct access to the DataStore
collections.

Declaration Syntax
C# Visual Basic Visual C++
public class DataStore

Public Class DataStore

public ref class DataStore

Members
All Members Constructors Methods Properties Events
Public Instance Declared
Protected Static Inherited
Icon Member Description
DataStore() Initializes a new instance of the
DataStore class.

CoilDiscretes Gets the coil discretes.

DataStoreReadFrom Occurs when the DataStore is read from


via a Modbus command.

DataStoreWrittenTo Occurs when the DataStore is written to


via a Modbus command.

Equals(Object) Determines whether the specified Object


is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is reclaimed
by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a particular
type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


HoldingRegisters Gets the holding registers.

InputDiscretes Gets the input discretes.

InputRegisters Gets the input registers.

MemberwiseClone() Creates a shallow copy of the current


Object.

(Inherited from Object.)


SyncRoot An object that can be used to synchronize
direct access to the DataStore collections.

ToString() Returns a String that represents the


current Object.

(Inherited from Object.)

Inheritance Hierarchy
Object
DataStore

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DataStore Constructor
Namespaces ► Modbus.Data ► DataStore ► DataStore() C#

Initializes a new instance of the DataStore class.

Declaration Syntax
C# Visual Basic Visual C++
public DataStore()

Public Sub New

public:
DataStore()

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CoilDiscretes Property
Namespaces ► Modbus.Data ► DataStore ► CoilDiscretes C#

Gets the coil discretes.

Declaration Syntax
C# Visual Basic Visual C++
public ModbusDataCollection<bool> CoilDiscretes { get; private set

Public Property CoilDiscretes As ModbusDataCollection(Of Boolean)

public:
property ModbusDataCollection<bool>^ CoilDiscretes {
ModbusDataCollection<bool>^ get ();
void set (ModbusDataCollection<bool>^ value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DataStoreReadFrom Event
Namespaces ► Modbus.Data ► DataStore ► DataStoreReadFrom
C#
Occurs when the DataStore is read from via a Modbus command.

Declaration Syntax
C# Visual Basic Visual C++
public event EventHandler<DataStoreEventArgs> DataStoreReadFrom

Public Event DataStoreReadFrom As EventHandler(Of DataStoreEventAr

public:
event EventHandler<DataStoreEventArgs^>^ DataStoreReadFrom {
void add (EventHandler<DataStoreEventArgs^>^ value);
void remove (EventHandler<DataStoreEventArgs^>^ value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DataStoreWrittenTo Event
Namespaces ► Modbus.Data ► DataStore ► DataStoreWrittenTo
C#
Occurs when the DataStore is written to via a Modbus command.

Declaration Syntax
C# Visual Basic Visual C++
public event EventHandler<DataStoreEventArgs> DataStoreWrittenTo

Public Event DataStoreWrittenTo As EventHandler(Of DataStoreEventA

public:
event EventHandler<DataStoreEventArgs^>^ DataStoreWrittenTo {
void add (EventHandler<DataStoreEventArgs^>^ value);
void remove (EventHandler<DataStoreEventArgs^>^ value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus HoldingRegisters Property
Namespaces ► Modbus.Data ► DataStore ► HoldingRegisters C#

Gets the holding registers.

Declaration Syntax
C# Visual Basic Visual C++
public ModbusDataCollection<ushort> HoldingRegisters { get; privat

Public Property HoldingRegisters As ModbusDataCollection(Of UShort

public:
property ModbusDataCollection<unsigned short>^ HoldingRegisters {
ModbusDataCollection<unsigned short>^ get ();
void set (ModbusDataCollection<unsigned short>^ value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus InputDiscretes Property
Namespaces ► Modbus.Data ► DataStore ► InputDiscretes C#

Gets the input discretes.

Declaration Syntax
C# Visual Basic Visual C++
public ModbusDataCollection<bool> InputDiscretes { get; private se

Public Property InputDiscretes As ModbusDataCollection(Of Boolean

public:
property ModbusDataCollection<bool>^ InputDiscretes {
ModbusDataCollection<bool>^ get ();
void set (ModbusDataCollection<bool>^ value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus InputRegisters Property
Namespaces ► Modbus.Data ► DataStore ► InputRegisters C#

Gets the input registers.

Declaration Syntax
C# Visual Basic Visual C++
public ModbusDataCollection<ushort> InputRegisters { get; private

Public Property InputRegisters As ModbusDataCollection(Of UShort)

public:
property ModbusDataCollection<unsigned short>^ InputRegisters {
ModbusDataCollection<unsigned short>^ get ();
void set (ModbusDataCollection<unsigned short>^ value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus SyncRoot Property
Namespaces ► Modbus.Data ► DataStore ► SyncRoot C#

An object that can be used to synchronize direct access to the DataStore


collections.

Declaration Syntax
C# Visual Basic Visual C++
public Object SyncRoot { get; }

Public ReadOnly Property SyncRoot As Object

public:
property Object^ SyncRoot {
Object^ get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DataStoreEventArgs Class
Namespaces ► Modbus.Data ► DataStoreEventArgs C#

Event args for read write actions performed on the DataStore.

Declaration Syntax
C# Visual Basic Visual C++
public class DataStoreEventArgs : EventArgs

Public Class DataStoreEventArgs _


Inherits EventArgs

public ref class DataStoreEventArgs : public EventArgs

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
Data Data that was read or written.

Equals(Object) Determines whether the specified Object


is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is reclaimed
by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a particular
type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.
(Inherited from Object.)
MemberwiseClone() Creates a shallow copy of the current
Object.

(Inherited from Object.)


ModbusDataType Type of Modbus data (e.g. Holding
register).

StartAddress Start address of data.

ToString() Returns a String that represents the


current Object.

(Inherited from Object.)

Inheritance Hierarchy
Object
EventArgs
DataStoreEventArgs

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Data Property
Namespaces ► Modbus.Data ► DataStoreEventArgs ► Data C#

Data that was read or written.

Declaration Syntax
C# Visual Basic Visual C++
public DiscriminatedUnion<ReadOnlyCollection<bool>, ReadOnlyCollec

Public Property Data As DiscriminatedUnion(Of ReadOnlyCollection(

public:
property DiscriminatedUnion<ReadOnlyCollection<bool>^, ReadOnlyCol
DiscriminatedUnion<ReadOnlyCollection<bool>^, ReadOnlyColl
void set (DiscriminatedUnion<ReadOnlyCollection<bool>^, Re
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusDataType Property
Namespaces ► Modbus.Data ► DataStoreEventArgs ► ModbusDataType
C#
Type of Modbus data (e.g. Holding register).

Declaration Syntax
C# Visual Basic Visual C++
public ModbusDataType ModbusDataType { get; private set; }

Public Property ModbusDataType As ModbusDataType

public:
property ModbusDataType ModbusDataType {
ModbusDataType get ();
void set (ModbusDataType value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus StartAddress Property
Namespaces ► Modbus.Data ► DataStoreEventArgs ► StartAddress
C#
Start address of data.

Declaration Syntax
C# Visual Basic Visual C++
public ushort StartAddress { get; private set; }

Public Property StartAddress As UShort

public:
property unsigned short StartAddress {
unsigned short get ();
void set (unsigned short value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DataStoreFactory Class
Namespaces ► Modbus.Data ► DataStoreFactory C#

Data story factory.

Declaration Syntax
C# Visual Basic Visual C++
public static class DataStoreFactory

Public NotInheritable Class DataStoreFactory

public ref class DataStoreFactory abstract sealed

Members
All Members Methods
Public Instance Declared
Protected Static Inherited
Icon Member Description
CreateDefaultDataStore() Factory method for default data store
- register values set to 0 and discrete
values set to false.

CreateDefaultDataStore(UInt16, Factory method for default data store


UInt16, UInt16, UInt16) - register values set to 0 and discrete
values set to false.

CreateTestDataStore() Factory method for test data store.

Inheritance Hierarchy
Object
DataStoreFactory

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateDefaultDataStore Method
Namespaces ► Modbus.Data ► DataStoreFactory ►
CreateDefaultDataStore()
C#
Members
Icon Member Description
CreateDefaultDataStore() Factory method for default data store
- register values set to 0 and discrete
values set to false.

CreateDefaultDataStore(UInt16, Factory method for default data store


UInt16, UInt16, UInt16) - register values set to 0 and discrete
values set to false.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateDefaultDataStore Method
Namespaces ► Modbus.Data ► DataStoreFactory ►
CreateDefaultDataStore()
C#
Factory method for default data store - register values set to 0 and discrete
values set to false.

Declaration Syntax
C# Visual Basic Visual C++
public static DataStore CreateDefaultDataStore()

Public Shared Function CreateDefaultDataStore As DataStore

public:
static DataStore^ CreateDefaultDataStore()

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


CreateDefaultDataStore Method (coilsCount,
NModbus

inputsCount, holdingRegistersCount,
inputRegistersCount)
Namespaces ► Modbus.Data ► DataStoreFactory ►
CreateDefaultDataStore(UInt16, UInt16, UInt16, UInt16)
C#
Factory method for default data store - register values set to 0 and discrete
values set to false.

Declaration Syntax
C# Visual Basic Visual C++
public static DataStore CreateDefaultDataStore(
ushort coilsCount,
ushort inputsCount,
ushort holdingRegistersCount,
ushort inputRegistersCount
)

Public Shared Function CreateDefaultDataStore ( _


coilsCount As UShort, _
inputsCount As UShort, _
holdingRegistersCount As UShort, _
inputRegistersCount As UShort _
) As DataStore

public:
static DataStore^ CreateDefaultDataStore(
unsigned short coilsCount,
unsigned short inputsCount,
unsigned short holdingRegistersCount,
unsigned short inputRegistersCount
)

Parameters
coilsCount (UInt16)
inputsCount (UInt16)
holdingRegistersCount (UInt16)
inputRegistersCount (UInt16)
Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)
NModbus CreateTestDataStore Method
Namespaces ► Modbus.Data ► DataStoreFactory ► CreateTestDataStore()
C#
Factory method for test data store.

Declaration Syntax
C# Visual Basic Visual C++
public static DataStore CreateTestDataStore()

Public Shared Function CreateTestDataStore As DataStore

public:
static DataStore^ CreateTestDataStore()

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DiscreteCollection Class
Namespaces ► Modbus.Data ► DiscreteCollection C#

Collection of discrete values.

Declaration Syntax
C# Visual Basic Visual C++
public class DiscreteCollection : Collection<bool>,
IModbusMessageDataCollection

Public Class DiscreteCollection _


Inherits Collection(Of Boolean) _
Implements IModbusMessageDataCollection

public ref class DiscreteCollection : public Collection<bool>,


IModbusMessageDataCollection

Members
All Members Constructors Methods Properties

Public Instance Declared


Protected Static
Inherited
Icon Member Description
DiscreteCollection() Initializes a new instance of the
DiscreteCollection class.

DiscreteCollection(Boolean[]) Initializes a new instance of the


DiscreteCollection class.

DiscreteCollection(Byte[]) Initializes a new instance of the


DiscreteCollection class.

DiscreteCollection(IList<Boolean>) Initializes a new instance of the


DiscreteCollection class.
Add(T) Adds an object to the end of the
Collection<T>.

(Inherited from
Collection<Boolean>.)
ByteCount Gets the byte count.

Clear() Removes all elements from the


Collection<T>.

(Inherited from
Collection<Boolean>.)
ClearItems() Removes all elements from the
Collection<T>.

(Inherited from
Collection<Boolean>.)
Contains(T) Determines whether an element is
in the Collection<T>.

(Inherited from
Collection<Boolean>.)
CopyTo(T[], Int32) Copies the entire Collection<T> to
a compatible one-dimensional
Array, starting at the specified
index of the target array.

(Inherited from
Collection<Boolean>.)
Count Gets the number of elements
actually contained in the
Collection<T>.

(Inherited from
Collection<Boolean>.)
Equals(Object) Determines whether the specified
Object is equal to the current
Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other
cleanup operations before the
Object is reclaimed by garbage
collection.

(Inherited from Object.)


GetEnumerator() Returns an enumerator that
iterates through the Collection<T>

(Inherited from
Collection<Boolean>.)
GetHashCode() Serves as a hash function for a
particular type.

(Inherited from Object.)


GetType() Gets the Type of the current
instance.

(Inherited from Object.)


IndexOf(T) Searches for the specified object
and returns the zero-based index of
the first occurrence within the
entire Collection<T>.

(Inherited from
Collection<Boolean>.)
Insert(Int32, T) Inserts an element into the
Collection<T> at the specified
index.

(Inherited from
Collection<Boolean>.)
InsertItem(Int32, T) Inserts an element into the
Collection<T> at the specified
index.
(Inherited from
Collection<Boolean>.)
Item[Int32] Gets or sets the element at the
specified index.

(Inherited from
Collection<Boolean>.)
Items Gets a IList<T> wrapper around
the Collection<T>.

(Inherited from
Collection<Boolean>.)
MemberwiseClone() Creates a shallow copy of the
current Object.

(Inherited from Object.)


NetworkBytes Gets the network bytes.

Remove(T) Removes the first occurrence of a


specific object from the
Collection<T>.

(Inherited from
Collection<Boolean>.)
RemoveAt(Int32) Removes the element at the
specified index of the
Collection<T>.

(Inherited from
Collection<Boolean>.)
RemoveItem(Int32) Removes the element at the
specified index of the
Collection<T>.

(Inherited from
Collection<Boolean>.)
SetItem(Int32, T) Replaces the element at the
specified index.
(Inherited from
Collection<Boolean>.)
ToString() Returns a String that represents
the current Object.

(Overrides Object.ToString().)

Inheritance Hierarchy
Object
Collection<Boolean>
DiscreteCollection

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DiscreteCollection Constructor
Namespaces ► Modbus.Data ► DiscreteCollection ► DiscreteCollection()
C#
Members
Icon Member Description
DiscreteCollection() Initializes a new instance of the
DiscreteCollection class.

DiscreteCollection(Boolean[]) Initializes a new instance of the


DiscreteCollection class.

DiscreteCollection(Byte[]) Initializes a new instance of the


DiscreteCollection class.

DiscreteCollection(IList<Boolean>) Initializes a new instance of the


DiscreteCollection class.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DiscreteCollection Constructor
Namespaces ► Modbus.Data ► DiscreteCollection ► DiscreteCollection()
C#
Initializes a new instance of the DiscreteCollection class.

Declaration Syntax
C# Visual Basic Visual C++
public DiscreteCollection()

Public Sub New

public:
DiscreteCollection()

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DiscreteCollection Constructor (bits)
Namespaces ► Modbus.Data ► DiscreteCollection ►
DiscreteCollection(Boolean[])
C#
Initializes a new instance of the DiscreteCollection class.

Declaration Syntax
C# Visual Basic Visual C++
public DiscreteCollection(
params bool[] bits
)

Public Sub New ( _


ParamArray bits As Boolean() _
)

public:
DiscreteCollection(
... array<bool>^ bits
)

Parameters
bits ( Boolean [])

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DiscreteCollection Constructor (bytes)
Namespaces ► Modbus.Data ► DiscreteCollection ►
DiscreteCollection(Byte[])
C#
Initializes a new instance of the DiscreteCollection class.

Declaration Syntax
C# Visual Basic Visual C++
public DiscreteCollection(
params byte[] bytes
)

Public Sub New ( _


ParamArray bytes As Byte() _
)

public:
DiscreteCollection(
... array<unsigned char>^ bytes
)

Parameters
bytes ( Byte [])

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DiscreteCollection Constructor (bits)
Namespaces ► Modbus.Data ► DiscreteCollection ►
DiscreteCollection(IList<Boolean>)
C#
Initializes a new instance of the DiscreteCollection class.

Declaration Syntax
C# Visual Basic Visual C++
public DiscreteCollection(
IList<bool> bits
)

Public Sub New ( _


bits As IList(Of Boolean) _
)

public:
DiscreteCollection(
IList<bool>^ bits
)

Parameters
bits (IList<Boolean>)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ByteCount Property
Namespaces ► Modbus.Data ► DiscreteCollection ► ByteCount
C#
Gets the byte count.

Declaration Syntax
C# Visual Basic Visual C++
public byte ByteCount { get; }

Public ReadOnly Property ByteCount As Byte

public:
virtual property unsigned char ByteCount {
unsigned char get () sealed;
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus NetworkBytes Property
Namespaces ► Modbus.Data ► DiscreteCollection ► NetworkBytes
C#
Gets the network bytes.

Declaration Syntax
C# Visual Basic Visual C++
public byte[] NetworkBytes { get; }

Public ReadOnly Property NetworkBytes As Byte()

public:
virtual property array<unsigned char>^ NetworkBytes {
array<unsigned char>^ get () sealed;
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ToString Method
Namespaces ► Modbus.Data ► DiscreteCollection ► ToString()
C#
Returns a String that represents the current Object.

Declaration Syntax
C# Visual Basic Visual C++
public override string ToString()

Public Overrides Function ToString As String

public:
virtual String^ ToString() override

Return Value
A String that represents the current Object.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus IModbusMessageDataCollection Interface
Namespaces ► Modbus.Data ► IModbusMessageDataCollection
C#
Modbus message containing data.

Declaration Syntax
C# Visual Basic Visual C++
public interface IModbusMessageDataCollection

Public Interface IModbusMessageDataCollection

public interface class IModbusMessageDataCollection

Members
All Members Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
ByteCount Gets the byte count.

NetworkBytes Gets the network bytes.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ByteCount Property
Namespaces ► Modbus.Data ► IModbusMessageDataCollection ► ByteCount
C#
Gets the byte count.

Declaration Syntax
C# Visual Basic Visual C++
byte ByteCount { get; }

ReadOnly Property ByteCount As Byte

property unsigned char ByteCount {


unsigned char get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus NetworkBytes Property
Namespaces ► Modbus.Data ► IModbusMessageDataCollection ►
NetworkBytes
C#
Gets the network bytes.

Declaration Syntax
C# Visual Basic Visual C++
byte[] NetworkBytes { get; }

ReadOnly Property NetworkBytes As Byte()

property array<unsigned char>^ NetworkBytes {


array<unsigned char>^ get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusDataCollection<TData> Class
Namespaces ► Modbus.Data ► ModbusDataCollection<TData>
C#
A 1 origin collection represetative of the Modbus Data Model.

Declaration Syntax
C# Visual Basic Visual C++
public class ModbusDataCollection<TData> : Collection<TData>

Public Class ModbusDataCollection(Of TData) _


Inherits Collection(Of TData)

generic<typename TData>
public ref class ModbusDataCollection : public Collection<TData>

Generic Template Parameters


TData

[Missing <typeparam name="TData"/> documentation for


"T:Modbus.Data.ModbusDataCollection`1"]

Members
All Members Constructors Methods Properties

Public Instance Declared


Protected Static
Inherited
Icon Member Description
ModbusDataCollection<TData>() Initializes a new instance
ModbusDataCollection

ModbusDataCollection<TData>(TData[]) Initializes a new instance


ModbusDataCollection

ModbusDataCollection<TData>(IList<TData>) Initializes a new instance


ModbusDataCollection
Add(T) Adds an object to the end
Collection<T>.

(Inherited from Collectio


Clear() Removes all elements fro
Collection<T>.

(Inherited from Collectio


ClearItems() Removes all elements fro
Collection<T>.

(Overrides
Collection<TData>.Clea
Contains(T) Determines whether an e
Collection<T>.

(Inherited from Collectio


CopyTo(T[], Int32) Copies the entire Collect
compatible one-dimensio
starting at the specified i
target array.

(Inherited from Collectio


Count Gets the number of elem
contained in the Collectio

(Inherited from Collectio


Equals(Object) Determines whether the
is equal to the current O

(Inherited from Object.)


Finalize() Allows an Object to attem
resources and perform ot
operations before the Ob
by garbage collection.

(Inherited from Object.)


GetEnumerator() Returns an enumerator t
through the Collection<

(Inherited from Collectio


GetHashCode() Serves as a hash functio
type.

(Inherited from Object.)


GetType() Gets the Type of the curr

(Inherited from Object.)


IndexOf(T) Searches for the specifie
returns the zero-based in
occurrence within the en
Collection<T>.

(Inherited from Collectio


Insert(Int32, T) Inserts an element into t
Collection<T> at the spe

(Inherited from Collectio


InsertItem(Int32, TData) Inserts an element into t
Collection<T> at the spe

(Overrides
Collection<TData>.Inser
T).)
Item[Int32] Gets or sets the element
index.

(Inherited from Collectio


Items Gets a IList<T> wrapper
Collection<T>.

(Inherited from Collectio


MemberwiseClone() Creates a shallow copy o
Object.

(Inherited from Object.)


Remove(T) Removes the first occurre
object from the Collectio

(Inherited from Collectio


RemoveAt(Int32) Removes the element at
index of the Collection<

(Inherited from Collectio


RemoveItem(Int32) Removes the element at
index of the Collection<

(Overrides
Collection<TData>.Rem
SetItem(Int32, TData) Replaces the element at
index.

(Overrides
Collection<TData>.SetIt
ToString() Returns a String that rep
current Object.

(Inherited from Object.)

Inheritance Hierarchy
Object
Collection<TData>
ModbusDataCollection<TData>

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusDataCollection<TData> Constructor
Namespaces ► Modbus.Data ► ModbusDataCollection<TData> ►
ModbusDataCollection<TData>()
C#
Members
Icon Member Description
ModbusDataCollection<TData>() Initializes a new instance
the
ModbusDataCollection<T
class.

ModbusDataCollection<TData>(TData[]) Initializes a new instance


the
ModbusDataCollection<T
class.

ModbusDataCollection<TData>(IList<TData>) Initializes a new instance


the
ModbusDataCollection<T
class.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusDataCollection<TData> Constructor
Namespaces ► Modbus.Data ► ModbusDataCollection<TData> ►
ModbusDataCollection<TData>()
C#
Initializes a new instance of the ModbusDataCollection<TData> class.

Declaration Syntax
C# Visual Basic Visual C++
public ModbusDataCollection()

Public Sub New

public:
ModbusDataCollection()

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ModbusDataCollection<TData> Constructor
NModbus

(data)
Namespaces ► Modbus.Data ► ModbusDataCollection<TData> ►
ModbusDataCollection<TData>(IList<TData>)
C#
Initializes a new instance of the ModbusDataCollection<TData> class.

Declaration Syntax
C# Visual Basic Visual C++
public ModbusDataCollection(
IList<TData> data
)

Public Sub New ( _


data As IList(Of TData) _
)

public:
ModbusDataCollection(
IList<TData>^ data
)

Parameters
data (IList<TData>)
The data.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ModbusDataCollection<TData> Constructor
NModbus

(data)
Namespaces ► Modbus.Data ► ModbusDataCollection<TData> ►
ModbusDataCollection<TData>(TData[])
C#
Initializes a new instance of the ModbusDataCollection<TData> class.

Declaration Syntax
C# Visual Basic Visual C++
public ModbusDataCollection(
params TData[] data
)

Public Sub New ( _


ParamArray data As TData() _
)

public:
ModbusDataCollection(
... array<TData>^ data
)

Parameters
data ( TData [])
The data.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ClearItems Method
Namespaces ► Modbus.Data ► ModbusDataCollection<TData> ►
ClearItems()
C#
Removes all elements from the Collection<T>.

Declaration Syntax
C# Visual Basic Visual C++
protected override void ClearItems()

Protected Overrides Sub ClearItems

protected:
virtual void ClearItems() override

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus InsertItem Method (index, item)
Namespaces ► Modbus.Data ► ModbusDataCollection<TData> ►
InsertItem(Int32, TData)
C#
Inserts an element into the Collection<T> at the specified index.

Declaration Syntax
C# Visual Basic Visual C++
protected override void InsertItem(
int index,
TData item
)

Protected Overrides Sub InsertItem ( _


index As Integer, _
item As TData _
)

protected:
virtual void InsertItem(
int index,
TData item
) override

Parameters
index (Int32)
The zero-based index at which item should be inserted.
item (TData)
The object to insert. The value can be null for reference types.

Exceptions
Exception Condition
ArgumentOutOfRangeExceptionindex is less than zero.-or-index is greater
than Count.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus RemoveItem Method (index)
Namespaces ► Modbus.Data ► ModbusDataCollection<TData> ►
RemoveItem(Int32)
C#
Removes the element at the specified index of the Collection<T>.

Declaration Syntax
C# Visual Basic Visual C++
protected override void RemoveItem(
int index
)

Protected Overrides Sub RemoveItem ( _


index As Integer _
)

protected:
virtual void RemoveItem(
int index
) override

Parameters
index (Int32)
The zero-based index of the element to remove.

Exceptions
Exception Condition
ArgumentOutOfRangeExceptionindex is less than zero.-or-index is equal to or
greater than Count.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus SetItem Method (index, item)
Namespaces ► Modbus.Data ► ModbusDataCollection<TData> ►
SetItem(Int32, TData)
C#
Replaces the element at the specified index.

Declaration Syntax
C# Visual Basic Visual C++
protected override void SetItem(
int index,
TData item
)

Protected Overrides Sub SetItem ( _


index As Integer, _
item As TData _
)

protected:
virtual void SetItem(
int index,
TData item
) override

Parameters
index (Int32)
The zero-based index of the element to replace.
item (TData)
The new value for the element at the specified index. The value can be
null for reference types.

Exceptions
Exception Condition
ArgumentOutOfRangeExceptionindex is less than zero.-or-index is greater
than Count.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusDataType Enumeration
Namespaces ► Modbus.Data ► ModbusDataType C#

Types of data supported by the Modbus protocol.

Declaration Syntax
C# Visual Basic Visual C++
public enum ModbusDataType

Public Enumeration ModbusDataType

public enum class ModbusDataType

Members
Member Description
HoldingRegister read/write register

InputRegister readonly register

Coil read/write discrete

Input readonly discrete

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus RegisterCollection Class
Namespaces ► Modbus.Data ► RegisterCollection C#

Collection of 16 bit registers.

Declaration Syntax
C# Visual Basic Visual C++
public class RegisterCollection : Collection<ushort>,
IModbusMessageDataCollection

Public Class RegisterCollection _


Inherits Collection(Of UShort) _
Implements IModbusMessageDataCollection

public ref class RegisterCollection : public Collection<unsigned s


IModbusMessageDataCollection

Members
All Members Constructors Methods Properties

Public Instance Declared


Protected Static
Inherited
Icon Member Description
RegisterCollection() Initializes a new instance of the
RegisterCollection class.

RegisterCollection(Byte[]) Initializes a new instance of the


RegisterCollection class.

RegisterCollection(UInt16[]) Initializes a new instance of the


RegisterCollection class.

RegisterCollection(IList<UInt16>) Initializes a new instance of the


RegisterCollection class.
Add(T) Adds an object to the end of the
Collection<T>.

(Inherited from
Collection<UInt16>.)
ByteCount Gets the byte count.

Clear() Removes all elements from the


Collection<T>.

(Inherited from
Collection<UInt16>.)
ClearItems() Removes all elements from the
Collection<T>.

(Inherited from
Collection<UInt16>.)
Contains(T) Determines whether an element is in
the Collection<T>.

(Inherited from
Collection<UInt16>.)
CopyTo(T[], Int32) Copies the entire Collection<T> to a
compatible one-dimensional Array,
starting at the specified index of the
target array.

(Inherited from
Collection<UInt16>.)
Count Gets the number of elements
actually contained in the
Collection<T>.

(Inherited from
Collection<UInt16>.)
Equals(Object) Determines whether the specified
Object is equal to the current
Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is
reclaimed by garbage collection.

(Inherited from Object.)


GetEnumerator() Returns an enumerator that iterates
through the Collection<T>.

(Inherited from
Collection<UInt16>.)
GetHashCode() Serves as a hash function for a
particular type.

(Inherited from Object.)


GetType() Gets the Type of the current
instance.

(Inherited from Object.)


IndexOf(T) Searches for the specified object and
returns the zero-based index of the
first occurrence within the entire
Collection<T>.

(Inherited from
Collection<UInt16>.)
Insert(Int32, T) Inserts an element into the
Collection<T> at the specified index.

(Inherited from
Collection<UInt16>.)
InsertItem(Int32, T) Inserts an element into the
Collection<T> at the specified index.

(Inherited from
Collection<UInt16>.)
Item[Int32] Gets or sets the element at the
specified index.

(Inherited from
Collection<UInt16>.)
Items Gets a IList<T> wrapper around the
Collection<T>.

(Inherited from
Collection<UInt16>.)
MemberwiseClone() Creates a shallow copy of the
current Object.

(Inherited from Object.)


NetworkBytes Gets the network bytes.

Remove(T) Removes the first occurrence of a


specific object from the
Collection<T>.

(Inherited from
Collection<UInt16>.)
RemoveAt(Int32) Removes the element at the
specified index of the Collection<T>

(Inherited from
Collection<UInt16>.)
RemoveItem(Int32) Removes the element at the
specified index of the Collection<T>

(Inherited from
Collection<UInt16>.)
SetItem(Int32, T) Replaces the element at the
specified index.

(Inherited from
Collection<UInt16>.)

ToString() Returns a String that represents the


current Object.

(Overrides Object.ToString().)

Inheritance Hierarchy
Object
Collection<UInt16>
RegisterCollection

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus RegisterCollection Constructor
Namespaces ► Modbus.Data ► RegisterCollection ► RegisterCollection()
C#
Members
Icon Member Description
RegisterCollection() Initializes a new instance of the
RegisterCollection class.

RegisterCollection(Byte[]) Initializes a new instance of the


RegisterCollection class.

RegisterCollection(UInt16[]) Initializes a new instance of the


RegisterCollection class.

RegisterCollection(IList<UInt16>) Initializes a new instance of the


RegisterCollection class.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus RegisterCollection Constructor
Namespaces ► Modbus.Data ► RegisterCollection ► RegisterCollection()
C#
Initializes a new instance of the RegisterCollection class.

Declaration Syntax
C# Visual Basic Visual C++
public RegisterCollection()

Public Sub New

public:
RegisterCollection()

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus RegisterCollection Constructor (bytes)
Namespaces ► Modbus.Data ► RegisterCollection ►
RegisterCollection(Byte[])
C#
Initializes a new instance of the RegisterCollection class.

Declaration Syntax
C# Visual Basic Visual C++
public RegisterCollection(
byte[] bytes
)

Public Sub New ( _


bytes As Byte() _
)

public:
RegisterCollection(
array<unsigned char>^ bytes
)

Parameters
bytes ( Byte [])

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus RegisterCollection Constructor (registers)
Namespaces ► Modbus.Data ► RegisterCollection ►
RegisterCollection(IList<UInt16>)
C#
Initializes a new instance of the RegisterCollection class.

Declaration Syntax
C# Visual Basic Visual C++
public RegisterCollection(
IList<ushort> registers
)

Public Sub New ( _


registers As IList(Of UShort) _
)

public:
RegisterCollection(
IList<unsigned short>^ registers
)

Parameters
registers (IList<UInt16>)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus RegisterCollection Constructor (registers)
Namespaces ► Modbus.Data ► RegisterCollection ►
RegisterCollection(UInt16[])
C#
Initializes a new instance of the RegisterCollection class.

Declaration Syntax
C# Visual Basic Visual C++
public RegisterCollection(
params ushort[] registers
)

Public Sub New ( _


ParamArray registers As UShort() _
)

public:
RegisterCollection(
... array<unsigned short>^ registers
)

Parameters
registers ( UInt16 [])

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ByteCount Property
Namespaces ► Modbus.Data ► RegisterCollection ► ByteCount
C#
Gets the byte count.

Declaration Syntax
C# Visual Basic Visual C++
public byte ByteCount { get; }

Public ReadOnly Property ByteCount As Byte

public:
virtual property unsigned char ByteCount {
unsigned char get () sealed;
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus NetworkBytes Property
Namespaces ► Modbus.Data ► RegisterCollection ► NetworkBytes
C#
Gets the network bytes.

Declaration Syntax
C# Visual Basic Visual C++
public byte[] NetworkBytes { get; }

Public ReadOnly Property NetworkBytes As Byte()

public:
virtual property array<unsigned char>^ NetworkBytes {
array<unsigned char>^ get () sealed;
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ToString Method
Namespaces ► Modbus.Data ► RegisterCollection ► ToString()
C#
Returns a String that represents the current Object.

Declaration Syntax
C# Visual Basic Visual C++
public override string ToString()

Public Overrides Function ToString As String

public:
virtual String^ ToString() override

Return Value
A String that represents the current Object.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Modbus.Device Namespace
Namespaces ► Modbus.Device C#

Modbus device.

Declaration Syntax
C# Visual Basic Visual C++
namespace Modbus.Device

Namespace Modbus.Device

namespace Modbus.Device

Types
All Types Classes Interfaces
Icon Type Description
IModbusMaster Modbus master device.

IModbusSerialMaster Modbus Serial Master device.

ModbusDevice Modbus device.

ModbusIpMaster Modbus IP master device.

ModbusMaster Modbus master device.

ModbusSerialMaster Modbus serial master device.

ModbusSerialSlave Modbus serial slave device.


ModbusSlave Modbus slave device.

ModbusSlaveRequestEventArgs Modbus Slave request event args


containing information on the
message.

ModbusTcpSlave Modbus TCP slave device.

ModbusUdpSlave Modbus UDP slave device.


NModbus IModbusMaster Interface
Namespaces ► Modbus.Device ► IModbusMaster C#

Modbus master device.

Declaration Syntax
C# Visual Basic Visual C++
public interface IModbusMaster : IDisposable

Public Interface IModbusMaster _


Implements IDisposable

public interface class IModbusMaster : IDisposable

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
Dispose() Performs application-defined tasks
associated with freeing, releasing, or
resetting unmanaged resources.

(Inherited from IDisposable.)


ReadCoils(Byte, UInt16, UInt16) Read from 1 to 2000 contiguous coils
status.

ReadHoldingRegisters(Byte, Read contiguous block of holding


UInt16, UInt16) registers.

ReadInputRegisters(Byte, Read contiguous block of input


UInt16, UInt16) registers.

ReadInputs(Byte, UInt16, Read from 1 to 2000 contiguous


UInt16) discrete input status.

ReadWriteMultipleRegisters(Byte, Performs a combination of one read


UInt16, UInt16, UInt16, operation and one write operation in
UInt16[]) a single Modbus transaction. The
write operation is performed before
the read.

Transport Transport for used by this master.

WriteMultipleCoils(Byte, UInt16, Force each coil in a sequence of coils


Boolean[]) to a provided value.

WriteMultipleRegisters(Byte, Write a block of 1 to 123 contiguous


UInt16, UInt16[]) registers.

WriteSingleCoil(Byte, UInt16, Write a single coil value.


Boolean)

WriteSingleRegister(Byte, Write a single holding register.


UInt16, UInt16)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadCoils Method (slaveAddress,
NModbus

startAddress, numberOfPoints)
Namespaces ► Modbus.Device ► IModbusMaster ► ReadCoils(Byte,
UInt16, UInt16)
C#
Read from 1 to 2000 contiguous coils status.

Declaration Syntax
C# Visual Basic Visual C++
bool[] ReadCoils(
byte slaveAddress,
ushort startAddress,
ushort numberOfPoints
)

Function ReadCoils ( _
slaveAddress As Byte, _
startAddress As UShort, _
numberOfPoints As UShort _
) As Boolean()

array<bool>^ ReadCoils(
unsigned char slaveAddress,
unsigned short startAddress,
unsigned short numberOfPoints
)

Parameters
slaveAddress (Byte)
Address of device to read values from.
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of coils to read.

Return Value
Coils status

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadHoldingRegisters Method (slaveAddress,
NModbus

startAddress, numberOfPoints)
Namespaces ► Modbus.Device ► IModbusMaster ►
ReadHoldingRegisters(Byte, UInt16, UInt16)
C#
Read contiguous block of holding registers.

Declaration Syntax
C# Visual Basic Visual C++
ushort[] ReadHoldingRegisters(
byte slaveAddress,
ushort startAddress,
ushort numberOfPoints
)

Function ReadHoldingRegisters ( _
slaveAddress As Byte, _
startAddress As UShort, _
numberOfPoints As UShort _
) As UShort()

array<unsigned short>^ ReadHoldingRegisters(


unsigned char slaveAddress,
unsigned short startAddress,
unsigned short numberOfPoints
)

Parameters
slaveAddress (Byte)
Address of device to read values from.
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of holding registers to read.

Return Value
Holding registers status

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadInputRegisters Method (slaveAddress,
NModbus

startAddress, numberOfPoints)
Namespaces ► Modbus.Device ► IModbusMaster ►
ReadInputRegisters(Byte, UInt16, UInt16)
C#
Read contiguous block of input registers.

Declaration Syntax
C# Visual Basic Visual C++
ushort[] ReadInputRegisters(
byte slaveAddress,
ushort startAddress,
ushort numberOfPoints
)

Function ReadInputRegisters ( _
slaveAddress As Byte, _
startAddress As UShort, _
numberOfPoints As UShort _
) As UShort()

array<unsigned short>^ ReadInputRegisters(


unsigned char slaveAddress,
unsigned short startAddress,
unsigned short numberOfPoints
)

Parameters
slaveAddress (Byte)
Address of device to read values from.
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of holding registers to read.

Return Value
Input registers status

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadInputs Method (slaveAddress,
NModbus

startAddress, numberOfPoints)
Namespaces ► Modbus.Device ► IModbusMaster ► ReadInputs(Byte,
UInt16, UInt16)
C#
Read from 1 to 2000 contiguous discrete input status.

Declaration Syntax
C# Visual Basic Visual C++
bool[] ReadInputs(
byte slaveAddress,
ushort startAddress,
ushort numberOfPoints
)

Function ReadInputs ( _
slaveAddress As Byte, _
startAddress As UShort, _
numberOfPoints As UShort _
) As Boolean()

array<bool>^ ReadInputs(
unsigned char slaveAddress,
unsigned short startAddress,
unsigned short numberOfPoints
)

Parameters
slaveAddress (Byte)
Address of device to read values from.
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of discrete inputs to read.

Return Value
Discrete inputs status

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadWriteMultipleRegisters Method
NModbus

(slaveAddress, startReadAddress,
numberOfPointsToRead, startWriteAddress,
writeData)
Namespaces ► Modbus.Device ► IModbusMaster ►
ReadWriteMultipleRegisters(Byte, UInt16, UInt16, UInt16, UInt16[])
C#
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 Syntax
C# Visual Basic Visual C++
ushort[] ReadWriteMultipleRegisters(
byte slaveAddress,
ushort startReadAddress,
ushort numberOfPointsToRead,
ushort startWriteAddress,
ushort[] writeData
)

Function ReadWriteMultipleRegisters ( _
slaveAddress As Byte, _
startReadAddress As UShort, _
numberOfPointsToRead As UShort, _
startWriteAddress As UShort, _
writeData As UShort() _
) As UShort()

array<unsigned short>^ ReadWriteMultipleRegisters(


unsigned char slaveAddress,
unsigned short startReadAddress,
unsigned short numberOfPointsToRead,
unsigned short startWriteAddress,
array<unsigned short>^ writeData
)

Parameters
slaveAddress (Byte)
Address of device to read values from.
startReadAddress (UInt16)
Address to begin reading (Holding registers are addressed starting at 0).
numberOfPointsToRead (UInt16)
Number of registers to read.
startWriteAddress (UInt16)
Address to begin writing (Holding registers are addressed starting at 0).
writeData ( UInt16 [])
Register values to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Transport Property
Namespaces ► Modbus.Device ► IModbusMaster ► Transport C#

Transport for used by this master.

Declaration Syntax
C# Visual Basic Visual C++
ModbusTransport Transport { get; }

ReadOnly Property Transport As ModbusTransport

property ModbusTransport^ Transport {


ModbusTransport^ get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteMultipleCoils Method (slaveAddress,
NModbus

startAddress, data)
Namespaces ► Modbus.Device ► IModbusMaster ►
WriteMultipleCoils(Byte, UInt16, Boolean[])
C#
Force each coil in a sequence of coils to a provided value.

Declaration Syntax
C# Visual Basic Visual C++
void WriteMultipleCoils(
byte slaveAddress,
ushort startAddress,
bool[] data
)

Sub WriteMultipleCoils ( _
slaveAddress As Byte, _
startAddress As UShort, _
data As Boolean() _
)

void WriteMultipleCoils(
unsigned char slaveAddress,
unsigned short startAddress,
array<bool>^ data
)

Parameters
slaveAddress (Byte)
Address of the device to write to.
startAddress (UInt16)
Address to begin writing values.
data ( Boolean [])
Values to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteMultipleRegisters Method
NModbus

(slaveAddress, startAddress, data)


Namespaces ► Modbus.Device ► IModbusMaster ►
WriteMultipleRegisters(Byte, UInt16, UInt16[])
C#
Write a block of 1 to 123 contiguous registers.

Declaration Syntax
C# Visual Basic Visual C++
void WriteMultipleRegisters(
byte slaveAddress,
ushort startAddress,
ushort[] data
)

Sub WriteMultipleRegisters ( _
slaveAddress As Byte, _
startAddress As UShort, _
data As UShort() _
)

void WriteMultipleRegisters(
unsigned char slaveAddress,
unsigned short startAddress,
array<unsigned short>^ data
)

Parameters
slaveAddress (Byte)
Address of the device to write to.
startAddress (UInt16)
Address to begin writing values.
data ( UInt16 [])
Values to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteSingleCoil Method (slaveAddress,
NModbus

coilAddress, value)
Namespaces ► Modbus.Device ► IModbusMaster ► WriteSingleCoil(Byte,
UInt16, Boolean)
C#
Write a single coil value.

Declaration Syntax
C# Visual Basic Visual C++
void WriteSingleCoil(
byte slaveAddress,
ushort coilAddress,
bool value
)

Sub WriteSingleCoil ( _
slaveAddress As Byte, _
coilAddress As UShort, _
value As Boolean _
)

void WriteSingleCoil(
unsigned char slaveAddress,
unsigned short coilAddress,
bool value
)

Parameters
slaveAddress (Byte)
Address of the device to write to.
coilAddress (UInt16)
Address to write value to.
value (Boolean)
Value to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteSingleRegister Method (slaveAddress,
NModbus

registerAddress, value)
Namespaces ► Modbus.Device ► IModbusMaster ►
WriteSingleRegister(Byte, UInt16, UInt16)
C#
Write a single holding register.

Declaration Syntax
C# Visual Basic Visual C++
void WriteSingleRegister(
byte slaveAddress,
ushort registerAddress,
ushort value
)

Sub WriteSingleRegister ( _
slaveAddress As Byte, _
registerAddress As UShort, _
value As UShort _
)

void WriteSingleRegister(
unsigned char slaveAddress,
unsigned short registerAddress,
unsigned short value
)

Parameters
slaveAddress (Byte)
Address of the device to write to.
registerAddress (UInt16)
Address to write.
value (UInt16)
Value to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus IModbusSerialMaster Interface
Namespaces ► Modbus.Device ► IModbusSerialMaster C#

Modbus Serial Master device.

Declaration Syntax
C# Visual Basic Visual C++
public interface IModbusSerialMaster : IModbusMaster,
IDisposable

Public Interface IModbusSerialMaster _


Implements IModbusMaster, IDisposable

public interface class IModbusSerialMaster : IModbusMaster,


IDisposable

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
Dispose() Performs application-defined tasks
associated with freeing, releasing, or
resetting unmanaged resources.

(Inherited from IDisposable.)


ReadCoils(Byte, UInt16, UInt16) Read from 1 to 2000 contiguous coils
status.

(Inherited from IModbusMaster.)


ReadHoldingRegisters(Byte, Read contiguous block of holding
UInt16, UInt16) registers.

(Inherited from IModbusMaster.)


ReadInputRegisters(Byte, Read contiguous block of input
UInt16, UInt16) registers.

(Inherited from IModbusMaster.)


ReadInputs(Byte, UInt16, Read from 1 to 2000 contiguous
UInt16) discrete input status.

(Inherited from IModbusMaster.)


ReadWriteMultipleRegisters(Byte, Performs a combination of one read
UInt16, UInt16, UInt16, operation and one write operation in
UInt16[]) a single Modbus transaction. The
write operation is performed before
the read.

(Inherited from IModbusMaster.)


ReturnQueryData(Byte, UInt16) Serial Line only. Diagnostic function
which loops back the original data.
NModbus only supports looping back
one ushort value, this is a limitation
of the "Best Effort" implementation of
the RTU protocol.

Transport Transport for used by this master.

Transport Transport for used by this master.

(Inherited from IModbusMaster.)


WriteMultipleCoils(Byte, UInt16, Force each coil in a sequence of coils
Boolean[]) to a provided value.

(Inherited from IModbusMaster.)


WriteMultipleRegisters(Byte, Write a block of 1 to 123 contiguous
UInt16, UInt16[]) registers.

(Inherited from IModbusMaster.)


WriteSingleCoil(Byte, UInt16, Write a single coil value.
Boolean)
(Inherited from IModbusMaster.)
WriteSingleRegister(Byte, Write a single holding register.
UInt16, UInt16)
(Inherited from IModbusMaster.)
Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)
ReturnQueryData Method (slaveAddress,
NModbus

data)
Namespaces ► Modbus.Device ► IModbusSerialMaster ►
ReturnQueryData(Byte, UInt16)
C#
Serial Line only. Diagnostic function which loops back the original data.
NModbus only supports looping back one ushort value, this is a limitation of
the "Best Effort" implementation of the RTU protocol.

Declaration Syntax
C# Visual Basic Visual C++
bool ReturnQueryData(
byte slaveAddress,
ushort data
)

Function ReturnQueryData ( _
slaveAddress As Byte, _
data As UShort _
) As Boolean

bool ReturnQueryData(
unsigned char slaveAddress,
unsigned short data
)

Parameters
slaveAddress (Byte)
Address of device to test.
data (UInt16)
Data to return.

Return Value
Return true if slave device echoed data.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Transport Property
Namespaces ► Modbus.Device ► IModbusSerialMaster ► Transport
C#
Transport for used by this master.

Declaration Syntax
C# Visual Basic Visual C++
ModbusSerialTransport Transport { get; }

ReadOnly Property Transport As ModbusSerialTransport

property ModbusSerialTransport^ Transport {


ModbusSerialTransport^ get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusDevice Class
Namespaces ► Modbus.Device ► ModbusDevice C#

Modbus device.

Declaration Syntax
C# Visual Basic Visual C++
public abstract class ModbusDevice : IDisposable

Public MustInherit Class ModbusDevice _


Implements IDisposable

public ref class ModbusDevice abstract : IDisposable

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
Dispose() Releases unmanaged and - optionally -
managed resources

Dispose(Boolean) Releases unmanaged and - optionally -


managed resources

Equals(Object) Determines whether the specified Object


is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is reclaimed
by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a particular
type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


MemberwiseClone() Creates a shallow copy of the current
Object.

(Inherited from Object.)


ToString() Returns a String that represents the
current Object.

(Inherited from Object.)


Transport Gets the Modbus Transport.

Inheritance Hierarchy
Object
ModbusDevice
ModbusMaster
ModbusSlave

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Dispose Method
Namespaces ► Modbus.Device ► ModbusDevice ► Dispose() C#

Members
Icon Member Description
Dispose() Releases unmanaged and - optionally -
managed resources

Dispose(Boolean) Releases unmanaged and - optionally -


managed resources

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Dispose Method
Namespaces ► Modbus.Device ► ModbusDevice ► Dispose() C#

Releases unmanaged and - optionally - managed resources

Declaration Syntax
C# Visual Basic Visual C++
public void Dispose()

Public Sub Dispose

public:
virtual void Dispose() sealed

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Dispose Method (disposing)
Namespaces ► Modbus.Device ► ModbusDevice ► Dispose(Boolean)
C#
Releases unmanaged and - optionally - managed resources

Declaration Syntax
C# Visual Basic Visual C++
protected virtual void Dispose(
bool disposing
)

Protected Overridable Sub Dispose ( _


disposing As Boolean _
)

protected:
virtual void Dispose(
bool disposing
)

Parameters
disposing (Boolean)
true to release both managed and unmanaged resources; false to
release only unmanaged resources.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Transport Property
Namespaces ► Modbus.Device ► ModbusDevice ► Transport C#

Gets the Modbus Transport.

Declaration Syntax
C# Visual Basic Visual C++
public ModbusTransport Transport { get; }

Public ReadOnly Property Transport As ModbusTransport

public:
virtual property ModbusTransport^ Transport {
ModbusTransport^ get () sealed;
}

Value
The transport.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusIpMaster Class
Namespaces ► Modbus.Device ► ModbusIpMaster C#

Modbus IP master device.

Declaration Syntax
C# Visual Basic Visual C++
public class ModbusIpMaster : ModbusMaster

Public Class ModbusIpMaster _


Inherits ModbusMaster

public ref class ModbusIpMaster : public ModbusMaster

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
CreateIp(TcpClient) Modbus IP
master factory
method.

CreateIp(UdpClient) Modbus IP
master factory
method.

CreateIp(SerialPort) Modbus IP
master factory
method.

CreateIp(IStreamResource) Modbus IP
master factory
method.
Dispose() Releases
unmanaged
and - optionall
- managed
resources

(Inherited from
ModbusDevice
Dispose(Boolean) Releases
unmanaged
and - optionall
- managed
resources

(Inherited from
ModbusDevice
Equals(Object) Determines
whether the
specified Objec
is equal to the
current Object

(Inherited from
Object.)
ExecuteCustomMessage<TResponse>(IModbusMessage) Executes the
custom
message.

(Inherited from
ModbusMaster
Finalize() Allows an
Object to
attempt to free
resources and
perform other
cleanup
operations
before the
Object is
reclaimed by
garbage
collection.

(Inherited from
Object.)
GetHashCode() Serves as a
hash function
for a particular
type.

(Inherited from
Object.)
GetType() Gets the Type
of the current
instance.

(Inherited from
Object.)
MemberwiseClone() Creates a
shallow copy o
the current
Object.

(Inherited from
Object.)
ReadCoils(UInt16, UInt16) Read from 1 to
2000
contiguous coil
status.

ReadCoils(Byte, UInt16, UInt16) Read from 1 to


2000
contiguous coil
status.

(Inherited from
ModbusMaster
ReadHoldingRegisters(UInt16, UInt16) Read
contiguous
block of holdin
registers.

ReadHoldingRegisters(Byte, UInt16, UInt16) Read


contiguous
block of 16 bit
holding
registers.

(Inherited from
ModbusMaster
ReadInputRegisters(UInt16, UInt16) Read
contiguous
block of input
registers.

ReadInputRegisters(Byte, UInt16, UInt16) Read


contiguous
block of 16 bit
input registers

(Inherited from
ModbusMaster
ReadInputs(UInt16, UInt16) Read from 1 to
2000
contiguous
discrete input
status.

ReadInputs(Byte, UInt16, UInt16) Read from 1 to


2000
contiguous
discrete input
status.

(Inherited from
ModbusMaster
ReadWriteMultipleRegisters(UInt16, UInt16, UInt16, Performs a
UInt16[]) combination of
one read
operation and
one write
operation in a
single MODBUS
transaction.
The write
operation is
performed
before the
read. Message
uses default
TCP slave id of
0.

ReadWriteMultipleRegisters(Byte, UInt16, UInt16, Performs a


UInt16, UInt16[]) combination of
one read
operation and
one write
operation in a
single Modbus
transaction.
The write
operation is
performed
before the
read.

(Inherited from
ModbusMaster
ToString() Returns a
String that
represents the
current Object

(Inherited from
Object.)
Transport Gets the
Modbus
Transport.

(Inherited from
ModbusDevice
WriteMultipleCoils(UInt16, Boolean[]) Force each coil
in a sequence
of coils to a
provided value

WriteMultipleCoils(Byte, UInt16, Boolean[]) Force each coil


in a sequence
of coils to a
provided value

(Inherited from
ModbusMaster
WriteMultipleRegisters(UInt16, UInt16[]) Write a block o
1 to 123
contiguous
registers.

WriteMultipleRegisters(Byte, UInt16, UInt16[]) Write a block o


1 to 123
contiguous 16
bit holding
registers.

(Inherited from
ModbusMaster
WriteSingleCoil(UInt16, Boolean) Write a single
coil value.

WriteSingleCoil(Byte, UInt16, Boolean) Write a single


coil value.

(Inherited from
ModbusMaster
WriteSingleRegister(UInt16, UInt16) Write a single
holding
register.

WriteSingleRegister(Byte, UInt16, UInt16) Write a single


holding
register.

(Inherited from
ModbusMaster

Inheritance Hierarchy
Object
ModbusDevice
ModbusMaster
ModbusIpMaster

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateIp Method
Namespaces ► Modbus.Device ► ModbusIpMaster ► CreateIp()
C#
Members
Icon Member Description
CreateIp(TcpClient) Modbus IP master factory method.

CreateIp(UdpClient) Modbus IP master factory method.

CreateIp(SerialPort) Modbus IP master factory method.

CreateIp(IStreamResource) Modbus IP master factory method.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateIp Method (streamResource)
Namespaces ► Modbus.Device ► ModbusIpMaster ►
CreateIp(IStreamResource)
C#
Modbus IP master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusIpMaster CreateIp(
IStreamResource streamResource
)

Public Shared Function CreateIp ( _


streamResource As IStreamResource _
) As ModbusIpMaster

public:
static ModbusIpMaster^ CreateIp(
IStreamResource^ streamResource
)

Parameters
streamResource (IStreamResource)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateIp Method (serialPort)
Namespaces ► Modbus.Device ► ModbusIpMaster ► CreateIp(SerialPort)
C#
Modbus IP master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusIpMaster CreateIp(
SerialPort serialPort
)

Public Shared Function CreateIp ( _


serialPort As SerialPort _
) As ModbusIpMaster

public:
static ModbusIpMaster^ CreateIp(
SerialPort^ serialPort
)

Parameters
serialPort (SerialPort)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateIp Method (tcpClient)
Namespaces ► Modbus.Device ► ModbusIpMaster ► CreateIp(TcpClient)
C#
Modbus IP master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusIpMaster CreateIp(
TcpClient tcpClient
)

Public Shared Function CreateIp ( _


tcpClient As TcpClient _
) As ModbusIpMaster

public:
static ModbusIpMaster^ CreateIp(
TcpClient^ tcpClient
)

Parameters
tcpClient (TcpClient)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateIp Method (udpClient)
Namespaces ► Modbus.Device ► ModbusIpMaster ► CreateIp(UdpClient)
C#
Modbus IP master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusIpMaster CreateIp(
UdpClient udpClient
)

Public Shared Function CreateIp ( _


udpClient As UdpClient _
) As ModbusIpMaster

public:
static ModbusIpMaster^ CreateIp(
UdpClient^ udpClient
)

Parameters
udpClient (UdpClient)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadCoils Method (startAddress,
NModbus

numberOfPoints)
Namespaces ► Modbus.Device ► ModbusIpMaster ► ReadCoils(UInt16,
UInt16)
C#
Read from 1 to 2000 contiguous coils status.

Declaration Syntax
C# Visual Basic Visual C++
public bool[] ReadCoils(
ushort startAddress,
ushort numberOfPoints
)

Public Function ReadCoils ( _


startAddress As UShort, _
numberOfPoints As UShort _
) As Boolean()

public:
array<bool>^ ReadCoils(
unsigned short startAddress,
unsigned short numberOfPoints
)

Parameters
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of coils to read.

Return Value
Coils status

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadHoldingRegisters Method (startAddress,
NModbus

numberOfPoints)
Namespaces ► Modbus.Device ► ModbusIpMaster ►
ReadHoldingRegisters(UInt16, UInt16)
C#
Read contiguous block of holding registers.

Declaration Syntax
C# Visual Basic Visual C++
public ushort[] ReadHoldingRegisters(
ushort startAddress,
ushort numberOfPoints
)

Public Function ReadHoldingRegisters ( _


startAddress As UShort, _
numberOfPoints As UShort _
) As UShort()

public:
array<unsigned short>^ ReadHoldingRegisters(
unsigned short startAddress,
unsigned short numberOfPoints
)

Parameters
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of holding registers to read.

Return Value
Holding registers status

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadInputRegisters Method (startAddress,
NModbus

numberOfPoints)
Namespaces ► Modbus.Device ► ModbusIpMaster ►
ReadInputRegisters(UInt16, UInt16)
C#
Read contiguous block of input registers.

Declaration Syntax
C# Visual Basic Visual C++
public ushort[] ReadInputRegisters(
ushort startAddress,
ushort numberOfPoints
)

Public Function ReadInputRegisters ( _


startAddress As UShort, _
numberOfPoints As UShort _
) As UShort()

public:
array<unsigned short>^ ReadInputRegisters(
unsigned short startAddress,
unsigned short numberOfPoints
)

Parameters
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of holding registers to read.

Return Value
Input registers status

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadInputs Method (startAddress,
NModbus

numberOfPoints)
Namespaces ► Modbus.Device ► ModbusIpMaster ► ReadInputs(UInt16,
UInt16)
C#
Read from 1 to 2000 contiguous discrete input status.

Declaration Syntax
C# Visual Basic Visual C++
public bool[] ReadInputs(
ushort startAddress,
ushort numberOfPoints
)

Public Function ReadInputs ( _


startAddress As UShort, _
numberOfPoints As UShort _
) As Boolean()

public:
array<bool>^ ReadInputs(
unsigned short startAddress,
unsigned short numberOfPoints
)

Parameters
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of discrete inputs to read.

Return Value
Discrete inputs status

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadWriteMultipleRegisters Method
NModbus

(startReadAddress, numberOfPointsToRead,
startWriteAddress, writeData)
Namespaces ► Modbus.Device ► ModbusIpMaster ►
ReadWriteMultipleRegisters(UInt16, UInt16, UInt16, UInt16[])
C#
Performs a combination of one read operation and one write operation in a
single MODBUS transaction. The write operation is performed before the read.
Message uses default TCP slave id of 0.

Declaration Syntax
C# Visual Basic Visual C++
public ushort[] ReadWriteMultipleRegisters(
ushort startReadAddress,
ushort numberOfPointsToRead,
ushort startWriteAddress,
ushort[] writeData
)

Public Function ReadWriteMultipleRegisters ( _


startReadAddress As UShort, _
numberOfPointsToRead As UShort, _
startWriteAddress As UShort, _
writeData As UShort() _
) As UShort()

public:
array<unsigned short>^ ReadWriteMultipleRegisters(
unsigned short startReadAddress,
unsigned short numberOfPointsToRead,
unsigned short startWriteAddress,
array<unsigned short>^ writeData
)

Parameters
startReadAddress (UInt16)
Address to begin reading (Holding registers are addressed starting at 0).
numberOfPointsToRead (UInt16)
Number of registers to read.
startWriteAddress (UInt16)
Address to begin writing (Holding registers are addressed starting at 0).
writeData ( UInt16 [])
Register values to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteMultipleCoils Method (startAddress,
NModbus

data)
Namespaces ► Modbus.Device ► ModbusIpMaster ►
WriteMultipleCoils(UInt16, Boolean[])
C#
Force each coil in a sequence of coils to a provided value.

Declaration Syntax
C# Visual Basic Visual C++
public void WriteMultipleCoils(
ushort startAddress,
bool[] data
)

Public Sub WriteMultipleCoils ( _


startAddress As UShort, _
data As Boolean() _
)

public:
void WriteMultipleCoils(
unsigned short startAddress,
array<bool>^ data
)

Parameters
startAddress (UInt16)
Address to begin writing values.
data ( Boolean [])
Values to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteMultipleRegisters Method
NModbus

(startAddress, data)
Namespaces ► Modbus.Device ► ModbusIpMaster ►
WriteMultipleRegisters(UInt16, UInt16[])
C#
Write a block of 1 to 123 contiguous registers.

Declaration Syntax
C# Visual Basic Visual C++
public void WriteMultipleRegisters(
ushort startAddress,
ushort[] data
)

Public Sub WriteMultipleRegisters ( _


startAddress As UShort, _
data As UShort() _
)

public:
void WriteMultipleRegisters(
unsigned short startAddress,
array<unsigned short>^ data
)

Parameters
startAddress (UInt16)
Address to begin writing values.
data ( UInt16 [])
Values to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus WriteSingleCoil Method (coilAddress, value)
Namespaces ► Modbus.Device ► ModbusIpMaster ►
WriteSingleCoil(UInt16, Boolean)
C#
Write a single coil value.

Declaration Syntax
C# Visual Basic Visual C++
public void WriteSingleCoil(
ushort coilAddress,
bool value
)

Public Sub WriteSingleCoil ( _


coilAddress As UShort, _
value As Boolean _
)

public:
void WriteSingleCoil(
unsigned short coilAddress,
bool value
)

Parameters
coilAddress (UInt16)
Address to write value to.
value (Boolean)
Value to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteSingleRegister Method
NModbus

(registerAddress, value)
Namespaces ► Modbus.Device ► ModbusIpMaster ►
WriteSingleRegister(UInt16, UInt16)
C#
Write a single holding register.

Declaration Syntax
C# Visual Basic Visual C++
public void WriteSingleRegister(
ushort registerAddress,
ushort value
)

Public Sub WriteSingleRegister ( _


registerAddress As UShort, _
value As UShort _
)

public:
void WriteSingleRegister(
unsigned short registerAddress,
unsigned short value
)

Parameters
registerAddress (UInt16)
Address to write.
value (UInt16)
Value to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusMaster Class
Namespaces ► Modbus.Device ► ModbusMaster C#

Modbus master device.

Declaration Syntax
C# Visual Basic Visual C++
public abstract class ModbusMaster : ModbusDevice,
IModbusMaster, IDisposable

Public MustInherit Class ModbusMaster _


Inherits ModbusDevice _
Implements IModbusMaster, IDisposable

public ref class ModbusMaster abstract : public ModbusDevice,


IModbusMaster, IDisposable

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
Dispose() Releases
unmanaged
and - optionall
- managed
resources

(Inherited from
ModbusDevice
Dispose(Boolean) Releases
unmanaged
and - optionall
- managed
resources

(Inherited from
ModbusDevice
Equals(Object) Determines
whether the
specified Objec
is equal to the
current Object

(Inherited from
Object.)
ExecuteCustomMessage<TResponse>(IModbusMessage) Executes the
custom
message.

Finalize() Allows an
Object to
attempt to free
resources and
perform other
cleanup
operations
before the
Object is
reclaimed by
garbage
collection.

(Inherited from
Object.)
GetHashCode() Serves as a
hash function
for a particular
type.

(Inherited from
Object.)
GetType() Gets the Type
of the current
instance.

(Inherited from
Object.)
MemberwiseClone() Creates a
shallow copy o
the current
Object.

(Inherited from
Object.)
ReadCoils(Byte, UInt16, UInt16) Read from 1 to
2000
contiguous
coils status.

ReadHoldingRegisters(Byte, UInt16, UInt16) Read


contiguous
block of 16 bit
holding
registers.

ReadInputRegisters(Byte, UInt16, UInt16) Read


contiguous
block of 16 bit
input registers

ReadInputs(Byte, UInt16, UInt16) Read from 1 to


2000
contiguous
discrete input
status.

ReadWriteMultipleRegisters(Byte, UInt16, UInt16, Performs a


UInt16, UInt16[]) combination of
one read
operation and
one write
operation in a
single Modbus
transaction.
The write
operation is
performed
before the
read.

ToString() Returns a
String that
represents the
current Object

(Inherited from
Object.)
Transport Gets the
Modbus
Transport.

(Inherited from
ModbusDevice
WriteMultipleCoils(Byte, UInt16, Boolean[]) Force each coil
in a sequence
of coils to a
provided value

WriteMultipleRegisters(Byte, UInt16, UInt16[]) Write a block o


1 to 123
contiguous 16
bit holding
registers.

WriteSingleCoil(Byte, UInt16, Boolean) Write a single


coil value.

WriteSingleRegister(Byte, UInt16, UInt16) Write a single


holding
register.

Inheritance Hierarchy
Object
ModbusDevice
ModbusMaster
ModbusIpMaster
ModbusSerialMaster

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ExecuteCustomMessage<TResponse> Method
NModbus

(request)
Namespaces ► Modbus.Device ► ModbusMaster ►
ExecuteCustomMessage<TResponse>(IModbusMessage)
C#
Executes the custom message.

Declaration Syntax
C# Visual Basic Visual C++
public TResponse ExecuteCustomMessage<TResponse>(
IModbusMessage request
)
where TResponse : new(), IModbusMessage

Public Function ExecuteCustomMessage(Of TResponse As {New, IModbus


request As IModbusMessage _
) As TResponse

public:
generic<typename TResponse>
where TResponse : gcnew(), IModbusMessage
TResponse ExecuteCustomMessage(
IModbusMessage^ request
)

Generic Template Parameters


TResponse
The type of the response.

Parameters
request (IModbusMessage)
The request.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReadCoils Method (slaveAddress,
NModbus

startAddress, numberOfPoints)
Namespaces ► Modbus.Device ► ModbusMaster ► ReadCoils(Byte,
UInt16, UInt16)
C#
Read from 1 to 2000 contiguous coils status.

Declaration Syntax
C# Visual Basic Visual C++
public bool[] ReadCoils(
byte slaveAddress,
ushort startAddress,
ushort numberOfPoints
)

Public Function ReadCoils ( _


slaveAddress As Byte, _
startAddress As UShort, _
numberOfPoints As UShort _
) As Boolean()

public:
virtual array<bool>^ ReadCoils(
unsigned char slaveAddress,
unsigned short startAddress,
unsigned short numberOfPoints
) sealed

Parameters
slaveAddress (Byte)
Address of device to read values from.
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of coils to read.

Return Value
Coils status
Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)
ReadHoldingRegisters Method (slaveAddress,
NModbus

startAddress, numberOfPoints)
Namespaces ► Modbus.Device ► ModbusMaster ►
ReadHoldingRegisters(Byte, UInt16, UInt16)
C#
Read contiguous block of 16 bit holding registers.

Declaration Syntax
C# Visual Basic Visual C++
public ushort[] ReadHoldingRegisters(
byte slaveAddress,
ushort startAddress,
ushort numberOfPoints
)

Public Function ReadHoldingRegisters ( _


slaveAddress As Byte, _
startAddress As UShort, _
numberOfPoints As UShort _
) As UShort()

public:
virtual array<unsigned short>^ ReadHoldingRegisters(
unsigned char slaveAddress,
unsigned short startAddress,
unsigned short numberOfPoints
) sealed

Parameters
slaveAddress (Byte)
Address of device to read values from.
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of holding registers to read.

Return Value
Holding registers status
Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)
ReadInputRegisters Method (slaveAddress,
NModbus

startAddress, numberOfPoints)
Namespaces ► Modbus.Device ► ModbusMaster ►
ReadInputRegisters(Byte, UInt16, UInt16)
C#
Read contiguous block of 16 bit input registers.

Declaration Syntax
C# Visual Basic Visual C++
public ushort[] ReadInputRegisters(
byte slaveAddress,
ushort startAddress,
ushort numberOfPoints
)

Public Function ReadInputRegisters ( _


slaveAddress As Byte, _
startAddress As UShort, _
numberOfPoints As UShort _
) As UShort()

public:
virtual array<unsigned short>^ ReadInputRegisters(
unsigned char slaveAddress,
unsigned short startAddress,
unsigned short numberOfPoints
) sealed

Parameters
slaveAddress (Byte)
Address of device to read values from.
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of holding registers to read.

Return Value
Input registers status
Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)
ReadInputs Method (slaveAddress,
NModbus

startAddress, numberOfPoints)
Namespaces ► Modbus.Device ► ModbusMaster ► ReadInputs(Byte,
UInt16, UInt16)
C#
Read from 1 to 2000 contiguous discrete input status.

Declaration Syntax
C# Visual Basic Visual C++
public bool[] ReadInputs(
byte slaveAddress,
ushort startAddress,
ushort numberOfPoints
)

Public Function ReadInputs ( _


slaveAddress As Byte, _
startAddress As UShort, _
numberOfPoints As UShort _
) As Boolean()

public:
virtual array<bool>^ ReadInputs(
unsigned char slaveAddress,
unsigned short startAddress,
unsigned short numberOfPoints
) sealed

Parameters
slaveAddress (Byte)
Address of device to read values from.
startAddress (UInt16)
Address to begin reading.
numberOfPoints (UInt16)
Number of discrete inputs to read.

Return Value
Discrete inputs status
Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)
ReadWriteMultipleRegisters Method
NModbus

(slaveAddress, startReadAddress,
numberOfPointsToRead, startWriteAddress,
writeData)
Namespaces ► Modbus.Device ► ModbusMaster ►
ReadWriteMultipleRegisters(Byte, UInt16, UInt16, UInt16, UInt16[])
C#
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 Syntax
C# Visual Basic Visual C++
public ushort[] ReadWriteMultipleRegisters(
byte slaveAddress,
ushort startReadAddress,
ushort numberOfPointsToRead,
ushort startWriteAddress,
ushort[] writeData
)

Public Function ReadWriteMultipleRegisters ( _


slaveAddress As Byte, _
startReadAddress As UShort, _
numberOfPointsToRead As UShort, _
startWriteAddress As UShort, _
writeData As UShort() _
) As UShort()

public:
virtual array<unsigned short>^ ReadWriteMultipleRegisters(
unsigned char slaveAddress,
unsigned short startReadAddress,
unsigned short numberOfPointsToRead,
unsigned short startWriteAddress,
array<unsigned short>^ writeData
) sealed

Parameters
slaveAddress (Byte)
Address of device to read values from.
startReadAddress (UInt16)
Address to begin reading (Holding registers are addressed starting at 0).
numberOfPointsToRead (UInt16)
Number of registers to read.
startWriteAddress (UInt16)
Address to begin writing (Holding registers are addressed starting at 0).
writeData ( UInt16 [])
Register values to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteMultipleCoils Method (slaveAddress,
NModbus

startAddress, data)
Namespaces ► Modbus.Device ► ModbusMaster ►
WriteMultipleCoils(Byte, UInt16, Boolean[])
C#
Force each coil in a sequence of coils to a provided value.

Declaration Syntax
C# Visual Basic Visual C++
public void WriteMultipleCoils(
byte slaveAddress,
ushort startAddress,
bool[] data
)

Public Sub WriteMultipleCoils ( _


slaveAddress As Byte, _
startAddress As UShort, _
data As Boolean() _
)

public:
virtual void WriteMultipleCoils(
unsigned char slaveAddress,
unsigned short startAddress,
array<bool>^ data
) sealed

Parameters
slaveAddress (Byte)
Address of the device to write to.
startAddress (UInt16)
Address to begin writing values.
data ( Boolean [])
Values to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteMultipleRegisters Method
NModbus

(slaveAddress, startAddress, data)


Namespaces ► Modbus.Device ► ModbusMaster ►
WriteMultipleRegisters(Byte, UInt16, UInt16[])
C#
Write a block of 1 to 123 contiguous 16 bit holding registers.

Declaration Syntax
C# Visual Basic Visual C++
public void WriteMultipleRegisters(
byte slaveAddress,
ushort startAddress,
ushort[] data
)

Public Sub WriteMultipleRegisters ( _


slaveAddress As Byte, _
startAddress As UShort, _
data As UShort() _
)

public:
virtual void WriteMultipleRegisters(
unsigned char slaveAddress,
unsigned short startAddress,
array<unsigned short>^ data
) sealed

Parameters
slaveAddress (Byte)
Address of the device to write to.
startAddress (UInt16)
Address to begin writing values.
data ( UInt16 [])
Values to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteSingleCoil Method (slaveAddress,
NModbus

coilAddress, value)
Namespaces ► Modbus.Device ► ModbusMaster ► WriteSingleCoil(Byte,
UInt16, Boolean)
C#
Write a single coil value.

Declaration Syntax
C# Visual Basic Visual C++
public void WriteSingleCoil(
byte slaveAddress,
ushort coilAddress,
bool value
)

Public Sub WriteSingleCoil ( _


slaveAddress As Byte, _
coilAddress As UShort, _
value As Boolean _
)

public:
virtual void WriteSingleCoil(
unsigned char slaveAddress,
unsigned short coilAddress,
bool value
) sealed

Parameters
slaveAddress (Byte)
Address of the device to write to.
coilAddress (UInt16)
Address to write value to.
value (Boolean)
Value to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


WriteSingleRegister Method (slaveAddress,
NModbus

registerAddress, value)
Namespaces ► Modbus.Device ► ModbusMaster ►
WriteSingleRegister(Byte, UInt16, UInt16)
C#
Write a single holding register.

Declaration Syntax
C# Visual Basic Visual C++
public void WriteSingleRegister(
byte slaveAddress,
ushort registerAddress,
ushort value
)

Public Sub WriteSingleRegister ( _


slaveAddress As Byte, _
registerAddress As UShort, _
value As UShort _
)

public:
virtual void WriteSingleRegister(
unsigned char slaveAddress,
unsigned short registerAddress,
unsigned short value
) sealed

Parameters
slaveAddress (Byte)
Address of the device to write to.
registerAddress (UInt16)
Address to write.
value (UInt16)
Value to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusSerialMaster Class
Namespaces ► Modbus.Device ► ModbusSerialMaster C#

Modbus serial master device.

Declaration Syntax
C# Visual Basic Visual C++
public class ModbusSerialMaster : ModbusMaster,
IModbusSerialMaster, IModbusMaster, IDisposable

Public Class ModbusSerialMaster _


Inherits ModbusMaster _
Implements IModbusSerialMaster, IModbusMaster, IDisposable

public ref class ModbusSerialMaster : public ModbusMaster,


IModbusSerialMaster, IModbusMaster, IDisposable

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
CreateAscii(SerialPort) Modbus ASCII
master factory
method.

CreateAscii(TcpClient) Modbus ASCII


master factory
method.

CreateAscii(UdpClient) Modbus ASCII


master factory
method.
CreateAscii(IStreamResource) Modbus ASCII
master factory
method.

CreateRtu(SerialPort) Modbus RTU


master factory
method.

CreateRtu(TcpClient) Modbus RTU


master factory
method.

CreateRtu(UdpClient) Modbus RTU


master factory
method.

CreateRtu(IStreamResource) Modbus RTU


master factory
method.

Dispose() Releases
unmanaged
and - optionall
- managed
resources

(Inherited from
ModbusDevice
Dispose(Boolean) Releases
unmanaged
and - optionall
- managed
resources

(Inherited from
ModbusDevice
Equals(Object) Determines
whether the
specified Objec
is equal to the
current Object

(Inherited from
Object.)
ExecuteCustomMessage<TResponse>(IModbusMessage) Executes the
custom
message.

(Inherited from
ModbusMaster
Finalize() Allows an
Object to
attempt to free
resources and
perform other
cleanup
operations
before the
Object is
reclaimed by
garbage
collection.

(Inherited from
Object.)
GetHashCode() Serves as a
hash function
for a particular
type.

(Inherited from
Object.)
GetType() Gets the Type
of the current
instance.
(Inherited from
Object.)

MemberwiseClone() Creates a
shallow copy o
the current
Object.

(Inherited from
Object.)
ReadCoils(Byte, UInt16, UInt16) Read from 1 to
2000
contiguous coil
status.

(Inherited from
ModbusMaster
ReadHoldingRegisters(Byte, UInt16, UInt16) Read
contiguous
block of 16 bit
holding
registers.

(Inherited from
ModbusMaster
ReadInputRegisters(Byte, UInt16, UInt16) Read
contiguous
block of 16 bit
input registers

(Inherited from
ModbusMaster
ReadInputs(Byte, UInt16, UInt16) Read from 1 to
2000
contiguous
discrete input
status.

(Inherited from
ModbusMaster
ReadWriteMultipleRegisters(Byte, UInt16, UInt16, Performs a
UInt16, UInt16[]) combination of
one read
operation and
one write
operation in a
single Modbus
transaction.
The write
operation is
performed
before the
read.

(Inherited from
ModbusMaster
ReturnQueryData(Byte, UInt16) Serial Line
only. Diagnosti
function which
loops back the
original data.
NModbus only
supports
looping back
one ushort
value, this is a
limitation of
the "Best
Effort"
implementation
of the RTU
protocol.

ToString() Returns a
String that
represents the
current Object

(Inherited from
Object.)
Transport Gets the
Modbus
Transport.

(Inherited from
ModbusDevice
WriteMultipleCoils(Byte, UInt16, Boolean[]) Force each coil
in a sequence
of coils to a
provided value

(Inherited from
ModbusMaster
WriteMultipleRegisters(Byte, UInt16, UInt16[]) Write a block o
1 to 123
contiguous 16
bit holding
registers.

(Inherited from
ModbusMaster
WriteSingleCoil(Byte, UInt16, Boolean) Write a single
coil value.

(Inherited from
ModbusMaster
WriteSingleRegister(Byte, UInt16, UInt16) Write a single
holding
register.

(Inherited from
ModbusMaster

Inheritance Hierarchy
Object
ModbusDevice
ModbusMaster
ModbusSerialMaster
Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)
NModbus CreateAscii Method
Namespaces ► Modbus.Device ► ModbusSerialMaster ► CreateAscii()
C#
Members
Icon Member Description
CreateAscii(SerialPort) Modbus ASCII master factory method.

CreateAscii(TcpClient) Modbus ASCII master factory method.

CreateAscii(UdpClient) Modbus ASCII master factory method.

CreateAscii(IStreamResource) Modbus ASCII master factory method.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateAscii Method (streamResource)
Namespaces ► Modbus.Device ► ModbusSerialMaster ►
CreateAscii(IStreamResource)
C#
Modbus ASCII master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialMaster CreateAscii(
IStreamResource streamResource
)

Public Shared Function CreateAscii ( _


streamResource As IStreamResource _
) As ModbusSerialMaster

public:
static ModbusSerialMaster^ CreateAscii(
IStreamResource^ streamResource
)

Parameters
streamResource (IStreamResource)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateAscii Method (serialPort)
Namespaces ► Modbus.Device ► ModbusSerialMaster ►
CreateAscii(SerialPort)
C#
Modbus ASCII master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialMaster CreateAscii(
SerialPort serialPort
)

Public Shared Function CreateAscii ( _


serialPort As SerialPort _
) As ModbusSerialMaster

public:
static ModbusSerialMaster^ CreateAscii(
SerialPort^ serialPort
)

Parameters
serialPort (SerialPort)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateAscii Method (tcpClient)
Namespaces ► Modbus.Device ► ModbusSerialMaster ►
CreateAscii(TcpClient)
C#
Modbus ASCII master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialMaster CreateAscii(
TcpClient tcpClient
)

Public Shared Function CreateAscii ( _


tcpClient As TcpClient _
) As ModbusSerialMaster

public:
static ModbusSerialMaster^ CreateAscii(
TcpClient^ tcpClient
)

Parameters
tcpClient (TcpClient)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateAscii Method (udpClient)
Namespaces ► Modbus.Device ► ModbusSerialMaster ►
CreateAscii(UdpClient)
C#
Modbus ASCII master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialMaster CreateAscii(
UdpClient udpClient
)

Public Shared Function CreateAscii ( _


udpClient As UdpClient _
) As ModbusSerialMaster

public:
static ModbusSerialMaster^ CreateAscii(
UdpClient^ udpClient
)

Parameters
udpClient (UdpClient)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateRtu Method
Namespaces ► Modbus.Device ► ModbusSerialMaster ► CreateRtu()
C#
Members
Icon Member Description
CreateRtu(SerialPort) Modbus RTU master factory method.

CreateRtu(TcpClient) Modbus RTU master factory method.

CreateRtu(UdpClient) Modbus RTU master factory method.

CreateRtu(IStreamResource) Modbus RTU master factory method.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateRtu Method (streamResource)
Namespaces ► Modbus.Device ► ModbusSerialMaster ►
CreateRtu(IStreamResource)
C#
Modbus RTU master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialMaster CreateRtu(
IStreamResource streamResource
)

Public Shared Function CreateRtu ( _


streamResource As IStreamResource _
) As ModbusSerialMaster

public:
static ModbusSerialMaster^ CreateRtu(
IStreamResource^ streamResource
)

Parameters
streamResource (IStreamResource)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateRtu Method (serialPort)
Namespaces ► Modbus.Device ► ModbusSerialMaster ►
CreateRtu(SerialPort)
C#
Modbus RTU master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialMaster CreateRtu(
SerialPort serialPort
)

Public Shared Function CreateRtu ( _


serialPort As SerialPort _
) As ModbusSerialMaster

public:
static ModbusSerialMaster^ CreateRtu(
SerialPort^ serialPort
)

Parameters
serialPort (SerialPort)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateRtu Method (tcpClient)
Namespaces ► Modbus.Device ► ModbusSerialMaster ►
CreateRtu(TcpClient)
C#
Modbus RTU master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialMaster CreateRtu(
TcpClient tcpClient
)

Public Shared Function CreateRtu ( _


tcpClient As TcpClient _
) As ModbusSerialMaster

public:
static ModbusSerialMaster^ CreateRtu(
TcpClient^ tcpClient
)

Parameters
tcpClient (TcpClient)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateRtu Method (udpClient)
Namespaces ► Modbus.Device ► ModbusSerialMaster ►
CreateRtu(UdpClient)
C#
Modbus RTU master factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialMaster CreateRtu(
UdpClient udpClient
)

Public Shared Function CreateRtu ( _


udpClient As UdpClient _
) As ModbusSerialMaster

public:
static ModbusSerialMaster^ CreateRtu(
UdpClient^ udpClient
)

Parameters
udpClient (UdpClient)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


ReturnQueryData Method (slaveAddress,
NModbus

data)
Namespaces ► Modbus.Device ► ModbusSerialMaster ►
ReturnQueryData(Byte, UInt16)
C#
Serial Line only. Diagnostic function which loops back the original data.
NModbus only supports looping back one ushort value, this is a limitation of
the "Best Effort" implementation of the RTU protocol.

Declaration Syntax
C# Visual Basic Visual C++
public bool ReturnQueryData(
byte slaveAddress,
ushort data
)

Public Function ReturnQueryData ( _


slaveAddress As Byte, _
data As UShort _
) As Boolean

public:
virtual bool ReturnQueryData(
unsigned char slaveAddress,
unsigned short data
) sealed

Parameters
slaveAddress (Byte)
Address of device to test.
data (UInt16)
Data to return.

Return Value
Return true if slave device echoed data.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusSerialSlave Class
Namespaces ► Modbus.Device ► ModbusSerialSlave C#

Modbus serial slave device.

Declaration Syntax
C# Visual Basic Visual C++
public class ModbusSerialSlave : ModbusSlave

Public Class ModbusSerialSlave _


Inherits ModbusSlave

public ref class ModbusSerialSlave : public ModbusSlave

Members
All Members Methods Properties Events

Public Instance Declared


Protected Static
Inherited
Icon Member Description
CreateAscii(Byte, SerialPort) Modbus ASCII slave factory method.

CreateAscii(Byte, Modbus ASCII slave factory method.


IStreamResource)

CreateRtu(Byte, SerialPort) Modbus RTU slave factory method.

CreateRtu(Byte, Modbus RTU slave factory method.


IStreamResource)

DataStore Gets or sets the data store.

(Inherited from ModbusSlave.)


Dispose() Releases unmanaged and - optionally -
managed resources

(Inherited from ModbusDevice.)


Dispose(Boolean) Releases unmanaged and - optionally -
managed resources

(Inherited from ModbusDevice.)


Equals(Object) Determines whether the specified Object
is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is
reclaimed by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a
particular type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


Listen() Start slave listening for requests.

(Overrides ModbusSlave.Listen().)
MemberwiseClone() Creates a shallow copy of the current
Object.

(Inherited from Object.)


ModbusSlaveRequestReceived Occurs when a modbus slave receives a
request.

(Inherited from ModbusSlave.)


ToString() Returns a String that represents the
current Object.

(Inherited from Object.)


Transport Gets the Modbus Transport.

(Inherited from ModbusDevice.)


UnitId Gets or sets the unit ID.

(Inherited from ModbusSlave.)

Inheritance Hierarchy
Object
ModbusDevice
ModbusSlave
ModbusSerialSlave

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateAscii Method
Namespaces ► Modbus.Device ► ModbusSerialSlave ► CreateAscii()
C#
Members
Icon Member Description
CreateAscii(Byte, SerialPort) Modbus ASCII slave factory method.

CreateAscii(Byte, Modbus ASCII slave factory method.


IStreamResource)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateAscii Method (unitId, streamResource)
Namespaces ► Modbus.Device ► ModbusSerialSlave ► CreateAscii(Byte,
IStreamResource)
C#
Modbus ASCII slave factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialSlave CreateAscii(
byte unitId,
IStreamResource streamResource
)

Public Shared Function CreateAscii ( _


unitId As Byte, _
streamResource As IStreamResource _
) As ModbusSerialSlave

public:
static ModbusSerialSlave^ CreateAscii(
unsigned char unitId,
IStreamResource^ streamResource
)

Parameters
unitId (Byte)
streamResource (IStreamResource)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateAscii Method (unitId, serialPort)
Namespaces ► Modbus.Device ► ModbusSerialSlave ► CreateAscii(Byte,
SerialPort)
C#
Modbus ASCII slave factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialSlave CreateAscii(
byte unitId,
SerialPort serialPort
)

Public Shared Function CreateAscii ( _


unitId As Byte, _
serialPort As SerialPort _
) As ModbusSerialSlave

public:
static ModbusSerialSlave^ CreateAscii(
unsigned char unitId,
SerialPort^ serialPort
)

Parameters
unitId (Byte)
serialPort (SerialPort)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateRtu Method
Namespaces ► Modbus.Device ► ModbusSerialSlave ► CreateRtu()
C#
Members
Icon Member Description
CreateRtu(Byte, SerialPort) Modbus RTU slave factory method.

CreateRtu(Byte, Modbus RTU slave factory method.


IStreamResource)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateRtu Method (unitId, streamResource)
Namespaces ► Modbus.Device ► ModbusSerialSlave ► CreateRtu(Byte,
IStreamResource)
C#
Modbus RTU slave factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialSlave CreateRtu(
byte unitId,
IStreamResource streamResource
)

Public Shared Function CreateRtu ( _


unitId As Byte, _
streamResource As IStreamResource _
) As ModbusSerialSlave

public:
static ModbusSerialSlave^ CreateRtu(
unsigned char unitId,
IStreamResource^ streamResource
)

Parameters
unitId (Byte)
streamResource (IStreamResource)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateRtu Method (unitId, serialPort)
Namespaces ► Modbus.Device ► ModbusSerialSlave ► CreateRtu(Byte,
SerialPort)
C#
Modbus RTU slave factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusSerialSlave CreateRtu(
byte unitId,
SerialPort serialPort
)

Public Shared Function CreateRtu ( _


unitId As Byte, _
serialPort As SerialPort _
) As ModbusSerialSlave

public:
static ModbusSerialSlave^ CreateRtu(
unsigned char unitId,
SerialPort^ serialPort
)

Parameters
unitId (Byte)
serialPort (SerialPort)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Listen Method
Namespaces ► Modbus.Device ► ModbusSerialSlave ► Listen()
C#
Start slave listening for requests.

Declaration Syntax
C# Visual Basic Visual C++
public override void Listen()

Public Overrides Sub Listen

public:
virtual void Listen() override

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusSlave Class
Namespaces ► Modbus.Device ► ModbusSlave C#

Modbus slave device.

Declaration Syntax
C# Visual Basic Visual C++
public abstract class ModbusSlave : ModbusDevice

Public MustInherit Class ModbusSlave _


Inherits ModbusDevice

public ref class ModbusSlave abstract : public ModbusDevice

Members
All Members Methods Properties Events

Public Instance Declared


Protected Static
Inherited
Icon Member Description
DataStore Gets or sets the data store.

Dispose() Releases unmanaged and - optionally -


managed resources

(Inherited from ModbusDevice.)


Dispose(Boolean) Releases unmanaged and - optionally -
managed resources

(Inherited from ModbusDevice.)


Equals(Object) Determines whether the specified Object
is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is
reclaimed by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a
particular type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


Listen() Start slave listening for requests.

MemberwiseClone() Creates a shallow copy of the current


Object.

(Inherited from Object.)


ModbusSlaveRequestReceived Occurs when a modbus slave receives a
request.

ToString() Returns a String that represents the


current Object.

(Inherited from Object.)


Transport Gets the Modbus Transport.

(Inherited from ModbusDevice.)


UnitId Gets or sets the unit ID.

Inheritance Hierarchy
Object
ModbusDevice
ModbusSlave
ModbusSerialSlave
ModbusTcpSlave
ModbusUdpSlave

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DataStore Property
Namespaces ► Modbus.Device ► ModbusSlave ► DataStore C#

Gets or sets the data store.

Declaration Syntax
C# Visual Basic Visual C++
public DataStore DataStore { get; set; }

Public Property DataStore As DataStore

public:
property DataStore^ DataStore {
DataStore^ get ();
void set (DataStore^ value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Listen Method
Namespaces ► Modbus.Device ► ModbusSlave ► Listen() C#

Start slave listening for requests.

Declaration Syntax
C# Visual Basic Visual C++
public abstract void Listen()

Public MustOverride Sub Listen

public:
virtual void Listen() abstract

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusSlaveRequestReceived Event
Namespaces ► Modbus.Device ► ModbusSlave ►
ModbusSlaveRequestReceived
C#
Occurs when a modbus slave receives a request.

Declaration Syntax
C# Visual Basic Visual C++
public event EventHandler<ModbusSlaveRequestEventArgs> ModbusSlave

Public Event ModbusSlaveRequestReceived As EventHandler(Of ModbusS

public:
event EventHandler<ModbusSlaveRequestEventArgs^>^ ModbusSlaveRequ
void add (EventHandler<ModbusSlaveRequestEventArgs^>^ valu
void remove (EventHandler<ModbusSlaveRequestEventArgs^>^
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus UnitId Property
Namespaces ► Modbus.Device ► ModbusSlave ► UnitId C#

Gets or sets the unit ID.

Declaration Syntax
C# Visual Basic Visual C++
public byte UnitId { get; set; }

Public Property UnitId As Byte

public:
property unsigned char UnitId {
unsigned char get ();
void set (unsigned char value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusSlaveRequestEventArgs Class
Namespaces ► Modbus.Device ► ModbusSlaveRequestEventArgs
C#
Modbus Slave request event args containing information on the message.

Declaration Syntax
C# Visual Basic Visual C++
public class ModbusSlaveRequestEventArgs : EventArgs

Public Class ModbusSlaveRequestEventArgs _


Inherits EventArgs

public ref class ModbusSlaveRequestEventArgs : public EventArgs

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
Equals(Object) Determines whether the specified Object
is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is reclaimed
by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a particular
type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


MemberwiseClone() Creates a shallow copy of the current
Object.

(Inherited from Object.)


Message Gets the message.

ToString() Returns a String that represents the


current Object.

(Inherited from Object.)

Inheritance Hierarchy
Object
EventArgs
ModbusSlaveRequestEventArgs

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Message Property
Namespaces ► Modbus.Device ► ModbusSlaveRequestEventArgs ► Message
C#
Gets the message.

Declaration Syntax
C# Visual Basic Visual C++
public IModbusMessage Message { get; }

Public ReadOnly Property Message As IModbusMessage

public:
property IModbusMessage^ Message {
IModbusMessage^ get ();
}

Value
The message.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusTcpSlave Class
Namespaces ► Modbus.Device ► ModbusTcpSlave C#

Modbus TCP slave device.

Declaration Syntax
C# Visual Basic Visual C++
public class ModbusTcpSlave : ModbusSlave

Public Class ModbusTcpSlave _


Inherits ModbusSlave

public ref class ModbusTcpSlave : public ModbusSlave

Members
All Members Methods Properties Events

Public Instance Declared


Protected Static
Inherited
Icon Member Description
CreateTcp(Byte, TcpListener) Modbus TCP slave factory method.

DataStore Gets or sets the data store.

(Inherited from ModbusSlave.)


Dispose(Boolean) Releases unmanaged and - optionally -
managed resources

(Overrides
ModbusDevice.Dispose(Boolean).)
Dispose() Releases unmanaged and - optionally -
managed resources

(Inherited from ModbusDevice.)


Equals(Object) Determines whether the specified Object
is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is
reclaimed by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a
particular type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


Listen() Start slave listening for requests.

(Overrides ModbusSlave.Listen().)
Masters Gets the Modbus TCP Masters connected
to this Modbus TCP Slave.

MemberwiseClone() Creates a shallow copy of the current


Object.

(Inherited from Object.)


ModbusSlaveRequestReceived Occurs when a modbus slave receives a
request.

(Inherited from ModbusSlave.)


ToString() Returns a String that represents the
current Object.

(Inherited from Object.)


Transport Gets the Modbus Transport.

(Inherited from ModbusDevice.)


UnitId Gets or sets the unit ID.
(Inherited from ModbusSlave.)

Inheritance Hierarchy
Object
ModbusDevice
ModbusSlave
ModbusTcpSlave

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateTcp Method (unitId, tcpListener)
Namespaces ► Modbus.Device ► ModbusTcpSlave ► CreateTcp(Byte,
TcpListener)
C#
Modbus TCP slave factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusTcpSlave CreateTcp(
byte unitId,
TcpListener tcpListener
)

Public Shared Function CreateTcp ( _


unitId As Byte, _
tcpListener As TcpListener _
) As ModbusTcpSlave

public:
static ModbusTcpSlave^ CreateTcp(
unsigned char unitId,
TcpListener^ tcpListener
)

Parameters
unitId (Byte)
tcpListener (TcpListener)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Dispose Method (disposing)
Namespaces ► Modbus.Device ► ModbusTcpSlave ► Dispose(Boolean)
C#
Releases unmanaged and - optionally - managed resources

Declaration Syntax
C# Visual Basic Visual C++
protected override void Dispose(
bool disposing
)

Protected Overrides Sub Dispose ( _


disposing As Boolean _
)

protected:
virtual void Dispose(
bool disposing
) override

Parameters
disposing (Boolean)
true to release both managed and unmanaged resources; false to
release only unmanaged resources.

Remarks
Dispose is thread-safe.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Listen Method
Namespaces ► Modbus.Device ► ModbusTcpSlave ► Listen() C#

Start slave listening for requests.

Declaration Syntax
C# Visual Basic Visual C++
public override void Listen()

Public Overrides Sub Listen

public:
virtual void Listen() override

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Masters Property
Namespaces ► Modbus.Device ► ModbusTcpSlave ► Masters C#

Gets the Modbus TCP Masters connected to this Modbus TCP Slave.

Declaration Syntax
C# Visual Basic Visual C++
public ReadOnlyCollection<TcpClient> Masters { get; }

Public ReadOnly Property Masters As ReadOnlyCollection(Of TcpClien

public:
property ReadOnlyCollection<TcpClient^>^ Masters {
ReadOnlyCollection<TcpClient^>^ get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusUdpSlave Class
Namespaces ► Modbus.Device ► ModbusUdpSlave C#

Modbus UDP slave device.

Declaration Syntax
C# Visual Basic Visual C++
public class ModbusUdpSlave : ModbusSlave

Public Class ModbusUdpSlave _


Inherits ModbusSlave

public ref class ModbusUdpSlave : public ModbusSlave

Members
All Members Methods Properties Events

Public Instance Declared


Protected Static
Inherited
Icon Member Description
CreateUdp(UdpClient) Modbus UDP slave factory method.
Creates NModbus UDP slave with default

CreateUdp(Byte, UdpClient) Modbus UDP slave factory method.

DataStore Gets or sets the data store.

(Inherited from ModbusSlave.)


Dispose() Releases unmanaged and - optionally -
managed resources

(Inherited from ModbusDevice.)


Dispose(Boolean) Releases unmanaged and - optionally -
managed resources
(Inherited from ModbusDevice.)

Equals(Object) Determines whether the specified Object


is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is
reclaimed by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a
particular type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


Listen() Start slave listening for requests.

(Overrides ModbusSlave.Listen().)
MemberwiseClone() Creates a shallow copy of the current
Object.

(Inherited from Object.)


ModbusSlaveRequestReceived Occurs when a modbus slave receives a
request.

(Inherited from ModbusSlave.)


ToString() Returns a String that represents the
current Object.

(Inherited from Object.)


Transport Gets the Modbus Transport.

(Inherited from ModbusDevice.)


UnitId Gets or sets the unit ID.
(Inherited from ModbusSlave.)

Inheritance Hierarchy
Object
ModbusDevice
ModbusSlave
ModbusUdpSlave

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateUdp Method
Namespaces ► Modbus.Device ► ModbusUdpSlave ► CreateUdp()
C#
Members
Icon Member Description
CreateUdp(UdpClient) Modbus UDP slave factory method.
Creates NModbus UDP slave with default

CreateUdp(Byte, UdpClient) Modbus UDP slave factory method.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateUdp Method (unitId, client)
Namespaces ► Modbus.Device ► ModbusUdpSlave ► CreateUdp(Byte,
UdpClient)
C#
Modbus UDP slave factory method.

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusUdpSlave CreateUdp(
byte unitId,
UdpClient client
)

Public Shared Function CreateUdp ( _


unitId As Byte, _
client As UdpClient _
) As ModbusUdpSlave

public:
static ModbusUdpSlave^ CreateUdp(
unsigned char unitId,
UdpClient^ client
)

Parameters
unitId (Byte)
client (UdpClient)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateUdp Method (client)
Namespaces ► Modbus.Device ► ModbusUdpSlave ►
CreateUdp(UdpClient)
C#
Modbus UDP slave factory method. Creates NModbus UDP slave with default

Declaration Syntax
C# Visual Basic Visual C++
public static ModbusUdpSlave CreateUdp(
UdpClient client
)

Public Shared Function CreateUdp ( _


client As UdpClient _
) As ModbusUdpSlave

public:
static ModbusUdpSlave^ CreateUdp(
UdpClient^ client
)

Parameters
client (UdpClient)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Listen Method
Namespaces ► Modbus.Device ► ModbusUdpSlave ► Listen() C#

Start slave listening for requests.

Declaration Syntax
C# Visual Basic Visual C++
public override void Listen()

Public Overrides Sub Listen

public:
virtual void Listen() override

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Modbus.IO Namespace
Namespaces ► Modbus.IO C#

Modbus transport IO.

Declaration Syntax
C# Visual Basic Visual C++
namespace Modbus.IO

Namespace Modbus.IO

namespace Modbus.IO

Types
All Types Classes Interfaces
Icon Type Description
EmptyTransport Empty placeholder.

IStreamResource Represents a serial resource. Implementor -


http://en.wikipedia.org/wiki/Bridge_Pattern

ModbusSerialTransport Transport for Serial protocols. Refined


Abstraction -
http://en.wikipedia.org/wiki/Bridge_Pattern

ModbusTransport Modbus transport. Abstraction -


http://en.wikipedia.org/wiki/Bridge_Pattern
NModbus EmptyTransport Class
Namespaces ► Modbus.IO ► EmptyTransport C#

Empty placeholder.

Declaration Syntax
C# Visual Basic Visual C++
public class EmptyTransport : ModbusTransport

Public Class EmptyTransport _


Inherits ModbusTransport

public ref class EmptyTransport : public ModbusTransport

Members
All Members Constructors Methods Properties

Public Instance Declared


Protected Static
Inherited
Icon Member Description
EmptyTransport() Initializes a new instance of the
EmptyTransport class

Dispose() Performs application-defined tasks


associated with freeing, releasing, or
resetting unmanaged resources.

(Inherited from ModbusTransport.)


Dispose(Boolean) Releases unmanaged and - optionally -
managed resources

(Inherited from ModbusTransport.)


Equals(Object) Determines whether the specified Object
is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is reclaimed
by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a particular
type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


MemberwiseClone() Creates a shallow copy of the current
Object.

(Inherited from Object.)


ReadTimeout Gets or sets the number of milliseconds
before a timeout occurs when a read
operation does not finish.

(Inherited from ModbusTransport.)


Retries Number of times to retry sending
message after encountering a failure
such as an IOException,
TimeoutException, or a corrupt message.

(Inherited from ModbusTransport.)


ToString() Returns a String that represents the
current Object.

(Inherited from Object.)


WaitToRetryMilliseconds Gets or sets the number of milliseconds
the tranport will wait before retrying a
message after receiving an
ACKNOWLEGE or SLAVE DEVICE BUSY
slave exception response.

(Inherited from ModbusTransport.)


WriteTimeout Gets or sets the number of milliseconds
before a timeout occurs when a write
operation does not finish.

(Inherited from ModbusTransport.)

Inheritance Hierarchy
Object
ModbusTransport
EmptyTransport

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus EmptyTransport Constructor
Namespaces ► Modbus.IO ► EmptyTransport ► EmptyTransport()
C#
Initializes a new instance of the EmptyTransport class

Declaration Syntax
C# Visual Basic Visual C++
public EmptyTransport()

Public Sub New

public:
EmptyTransport()

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus IStreamResource Interface
Namespaces ► Modbus.IO ► IStreamResource C#

Represents a serial resource. Implementor -


http://en.wikipedia.org/wiki/Bridge_Pattern

Declaration Syntax
C# Visual Basic Visual C++
public interface IStreamResource : IDisposable

Public Interface IStreamResource _


Implements IDisposable

public interface class IStreamResource : IDisposable

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
DiscardInBuffer() Purges the receive buffer.

Dispose() Performs application-defined tasks


associated with freeing, releasing, or
resetting unmanaged resources.

(Inherited from IDisposable.)


InfiniteTimeout Indicates that no timeout should occur.

Read(Byte[], Int32, Int32) Reads a number of bytes from the input


buffer and writes those bytes into a byte
array at the specified offset.

ReadTimeout Gets or sets the number of milliseconds


before a timeout occurs when a read
operation does not finish.

Write(Byte[], Int32, Int32) Writes a specified number of bytes to the


port from an output buffer, starting at the
specified offset.

WriteTimeout Gets or sets the number of milliseconds


before a timeout occurs when a write
operation does not finish.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DiscardInBuffer Method
Namespaces ► Modbus.IO ► IStreamResource ► DiscardInBuffer()
C#
Purges the receive buffer.

Declaration Syntax
C# Visual Basic Visual C++
void DiscardInBuffer()

Sub DiscardInBuffer

void DiscardInBuffer()

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus InfiniteTimeout Property
Namespaces ► Modbus.IO ► IStreamResource ► InfiniteTimeout
C#
Indicates that no timeout should occur.

Declaration Syntax
C# Visual Basic Visual C++
int InfiniteTimeout { get; }

ReadOnly Property InfiniteTimeout As Integer

property int InfiniteTimeout {


int get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Read Method (buffer, offset, count)
Namespaces ► Modbus.IO ► IStreamResource ► Read(Byte[], Int32,
Int32)
C#
Reads a number of bytes from the input buffer and writes those bytes into a
byte array at the specified offset.

Declaration Syntax
C# Visual Basic Visual C++
int Read(
byte[] buffer,
int offset,
int count
)

Function Read ( _
buffer As Byte(), _
offset As Integer, _
count As Integer _
) As Integer

int Read(
array<unsigned char>^ buffer,
int offset,
int count
)

Parameters
buffer ( Byte [])
The byte array to write the input to.
offset (Int32)
The offset in the buffer array to begin writing.
count (Int32)
The number of bytes to read.

Return Value
The number of bytes read.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ReadTimeout Property
Namespaces ► Modbus.IO ► IStreamResource ► ReadTimeout
C#
Gets or sets the number of milliseconds before a timeout occurs when a read
operation does not finish.

Declaration Syntax
C# Visual Basic Visual C++
int ReadTimeout { get; set; }

Property ReadTimeout As Integer

property int ReadTimeout {


int get ();
void set (int value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Write Method (buffer, offset, count)
Namespaces ► Modbus.IO ► IStreamResource ► Write(Byte[], Int32,
Int32)
C#
Writes a specified number of bytes to the port from an output buffer, starting
at the specified offset.

Declaration Syntax
C# Visual Basic Visual C++
void Write(
byte[] buffer,
int offset,
int count
)

Sub Write ( _
buffer As Byte(), _
offset As Integer, _
count As Integer _
)

void Write(
array<unsigned char>^ buffer,
int offset,
int count
)

Parameters
buffer ( Byte [])
The byte array that contains the data to write to the port.
offset (Int32)
The offset in the buffer array to begin writing.
count (Int32)
The number of bytes to write.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus WriteTimeout Property
Namespaces ► Modbus.IO ► IStreamResource ► WriteTimeout
C#
Gets or sets the number of milliseconds before a timeout occurs when a write
operation does not finish.

Declaration Syntax
C# Visual Basic Visual C++
int WriteTimeout { get; set; }

Property WriteTimeout As Integer

property int WriteTimeout {


int get ();
void set (int value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusSerialTransport Class
Namespaces ► Modbus.IO ► ModbusSerialTransport C#

Transport for Serial protocols. Refined Abstraction -


http://en.wikipedia.org/wiki/Bridge_Pattern

Declaration Syntax
C# Visual Basic Visual C++
public abstract class ModbusSerialTransport : ModbusTransport

Public MustInherit Class ModbusSerialTransport _


Inherits ModbusTransport

public ref class ModbusSerialTransport abstract : public ModbusTra

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
CheckFrame Gets or sets a value indicating whether
LRC/CRC frame checking is performed on
messages.

Dispose() Performs application-defined tasks


associated with freeing, releasing, or
resetting unmanaged resources.

(Inherited from ModbusTransport.)


Dispose(Boolean) Releases unmanaged and - optionally -
managed resources

(Inherited from ModbusTransport.)


Equals(Object) Determines whether the specified Object
is equal to the current Object.
(Inherited from Object.)
Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is reclaimed
by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a particular
type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


MemberwiseClone() Creates a shallow copy of the current
Object.

(Inherited from Object.)


ReadTimeout Gets or sets the number of milliseconds
before a timeout occurs when a read
operation does not finish.

(Inherited from ModbusTransport.)


Retries Number of times to retry sending
message after encountering a failure
such as an IOException,
TimeoutException, or a corrupt message.

(Inherited from ModbusTransport.)


ToString() Returns a String that represents the
current Object.

(Inherited from Object.)


WaitToRetryMilliseconds Gets or sets the number of milliseconds
the tranport will wait before retrying a
message after receiving an
ACKNOWLEGE or SLAVE DEVICE BUSY
slave exception response.
(Inherited from ModbusTransport.)
WriteTimeout Gets or sets the number of milliseconds
before a timeout occurs when a write
operation does not finish.

(Inherited from ModbusTransport.)

Inheritance Hierarchy
Object
ModbusTransport
ModbusSerialTransport

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CheckFrame Property
Namespaces ► Modbus.IO ► ModbusSerialTransport ► CheckFrame
C#
Gets or sets a value indicating whether LRC/CRC frame checking is performed
on messages.

Declaration Syntax
C# Visual Basic Visual C++
public bool CheckFrame { get; set; }

Public Property CheckFrame As Boolean

public:
property bool CheckFrame {
bool get ();
void set (bool value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusTransport Class
Namespaces ► Modbus.IO ► ModbusTransport C#

Modbus transport. Abstraction - http://en.wikipedia.org/wiki/Bridge_Pattern

Declaration Syntax
C# Visual Basic Visual C++
public abstract class ModbusTransport : IDisposable

Public MustInherit Class ModbusTransport _


Implements IDisposable

public ref class ModbusTransport abstract : IDisposable

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
Dispose() Performs application-defined tasks
associated with freeing, releasing, or
resetting unmanaged resources.

Dispose(Boolean) Releases unmanaged and - optionally -


managed resources

Equals(Object) Determines whether the specified Object


is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is reclaimed
by garbage collection.
(Inherited from Object.)
GetHashCode() Serves as a hash function for a particular
type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


MemberwiseClone() Creates a shallow copy of the current
Object.

(Inherited from Object.)


ReadTimeout Gets or sets the number of milliseconds
before a timeout occurs when a read
operation does not finish.

Retries Number of times to retry sending


message after encountering a failure
such as an IOException,
TimeoutException, or a corrupt message.

ToString() Returns a String that represents the


current Object.

(Inherited from Object.)


WaitToRetryMilliseconds Gets or sets the number of milliseconds
the tranport will wait before retrying a
message after receiving an
ACKNOWLEGE or SLAVE DEVICE BUSY
slave exception response.

WriteTimeout Gets or sets the number of milliseconds


before a timeout occurs when a write
operation does not finish.
Inheritance Hierarchy
Object
ModbusTransport
EmptyTransport
ModbusSerialTransport

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Dispose Method
Namespaces ► Modbus.IO ► ModbusTransport ► Dispose() C#

Members
Icon Member Description
Dispose() Performs application-defined tasks
associated with freeing, releasing, or
resetting unmanaged resources.

Dispose(Boolean) Releases unmanaged and - optionally -


managed resources

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Dispose Method
Namespaces ► Modbus.IO ► ModbusTransport ► Dispose() C#

Performs application-defined tasks associated with freeing, releasing, or


resetting unmanaged resources.

Declaration Syntax
C# Visual Basic Visual C++
public void Dispose()

Public Sub Dispose

public:
virtual void Dispose() sealed

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Dispose Method (disposing)
Namespaces ► Modbus.IO ► ModbusTransport ► Dispose(Boolean)
C#
Releases unmanaged and - optionally - managed resources

Declaration Syntax
C# Visual Basic Visual C++
protected virtual void Dispose(
bool disposing
)

Protected Overridable Sub Dispose ( _


disposing As Boolean _
)

protected:
virtual void Dispose(
bool disposing
)

Parameters
disposing (Boolean)
true to release both managed and unmanaged resources; false to
release only unmanaged resources.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ReadTimeout Property
Namespaces ► Modbus.IO ► ModbusTransport ► ReadTimeout
C#
Gets or sets the number of milliseconds before a timeout occurs when a read
operation does not finish.

Declaration Syntax
C# Visual Basic Visual C++
public int ReadTimeout { get; set; }

Public Property ReadTimeout As Integer

public:
property int ReadTimeout {
int get ();
void set (int value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Retries Property
Namespaces ► Modbus.IO ► ModbusTransport ► Retries C#

Number of times to retry sending message after encountering a failure such as


an IOException, TimeoutException, or a corrupt message.

Declaration Syntax
C# Visual Basic Visual C++
public int Retries { get; set; }

Public Property Retries As Integer

public:
property int Retries {
int get ();
void set (int value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus WaitToRetryMilliseconds Property
Namespaces ► Modbus.IO ► ModbusTransport ► WaitToRetryMilliseconds
C#
Gets or sets the number of milliseconds the tranport will wait before retrying a
message after receiving an ACKNOWLEGE or SLAVE DEVICE BUSY slave
exception response.

Declaration Syntax
C# Visual Basic Visual C++
public int WaitToRetryMilliseconds { get; set; }

Public Property WaitToRetryMilliseconds As Integer

public:
property int WaitToRetryMilliseconds {
int get ();
void set (int value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus WriteTimeout Property
Namespaces ► Modbus.IO ► ModbusTransport ► WriteTimeout
C#
Gets or sets the number of milliseconds before a timeout occurs when a write
operation does not finish.

Declaration Syntax
C# Visual Basic Visual C++
public int WriteTimeout { get; set; }

Public Property WriteTimeout As Integer

public:
property int WriteTimeout {
int get ();
void set (int value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Modbus.Message Namespace
Namespaces ► Modbus.Message C#

Modbus messages.

Declaration Syntax
C# Visual Basic Visual C++
namespace Modbus.Message

Namespace Modbus.Message

namespace Modbus.Message

Types
All Types Interfaces
Icon Type Description
IModbusMessage A message built by the master (client)
that initiates a Modbus transaction.

IModbusRequest Methods specific to a modbus request


message.
NModbus IModbusMessage Interface
Namespaces ► Modbus.Message ► IModbusMessage C#

A message built by the master (client) that initiates a Modbus transaction.

Declaration Syntax
C# Visual Basic Visual C++
public interface IModbusMessage

Public Interface IModbusMessage

public interface class IModbusMessage

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
FunctionCode The function code tells the server what
kind of action to perform.

Initialize(Byte[]) Initializes a modbus message from the


specified message frame.

MessageFrame Composition of the slave address and


protocol data unit.

ProtocolDataUnit Composition of the function code and


message data.

SlaveAddress Address of the slave (server).


TransactionId A unique identifier assigned to a message
when using the IP protocol.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus FunctionCode Property
Namespaces ► Modbus.Message ► IModbusMessage ► FunctionCode
C#
The function code tells the server what kind of action to perform.

Declaration Syntax
C# Visual Basic Visual C++
byte FunctionCode { get; set; }

Property FunctionCode As Byte

property unsigned char FunctionCode {


unsigned char get ();
void set (unsigned char value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Initialize Method (frame)
Namespaces ► Modbus.Message ► IModbusMessage ► Initialize(Byte[])
C#
Initializes a modbus message from the specified message frame.

Declaration Syntax
C# Visual Basic Visual C++
void Initialize(
byte[] frame
)

Sub Initialize ( _
frame As Byte() _
)

void Initialize(
array<unsigned char>^ frame
)

Parameters
frame ( Byte [])
The frame.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus MessageFrame Property
Namespaces ► Modbus.Message ► IModbusMessage ► MessageFrame
C#
Composition of the slave address and protocol data unit.

Declaration Syntax
C# Visual Basic Visual C++
byte[] MessageFrame { get; }

ReadOnly Property MessageFrame As Byte()

property array<unsigned char>^ MessageFrame {


array<unsigned char>^ get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ProtocolDataUnit Property
Namespaces ► Modbus.Message ► IModbusMessage ► ProtocolDataUnit
C#
Composition of the function code and message data.

Declaration Syntax
C# Visual Basic Visual C++
byte[] ProtocolDataUnit { get; }

ReadOnly Property ProtocolDataUnit As Byte()

property array<unsigned char>^ ProtocolDataUnit {


array<unsigned char>^ get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus SlaveAddress Property
Namespaces ► Modbus.Message ► IModbusMessage ► SlaveAddress
C#
Address of the slave (server).

Declaration Syntax
C# Visual Basic Visual C++
byte SlaveAddress { get; set; }

Property SlaveAddress As Byte

property unsigned char SlaveAddress {


unsigned char get ();
void set (unsigned char value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus TransactionId Property
Namespaces ► Modbus.Message ► IModbusMessage ► TransactionId
C#
A unique identifier assigned to a message when using the IP protocol.

Declaration Syntax
C# Visual Basic Visual C++
ushort TransactionId { get; set; }

Property TransactionId As UShort

property unsigned short TransactionId {


unsigned short get ();
void set (unsigned short value);
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus IModbusRequest Interface
Namespaces ► Modbus.Message ► IModbusRequest C#

Methods specific to a modbus request message.

Declaration Syntax
C# Visual Basic Visual C++
public interface IModbusRequest : IModbusMessage

Public Interface IModbusRequest _


Implements IModbusMessage

public interface class IModbusRequest : IModbusMessage

Members
All Members Methods Properties
Public Instance Declared
Protected Static Inherited
Icon Member Description
FunctionCode The function code tells the server
what kind of action to perform.

(Inherited from IModbusMessage.)


Initialize(Byte[]) Initializes a modbus message from
the specified message frame.

(Inherited from IModbusMessage.)


MessageFrame Composition of the slave address
and protocol data unit.

(Inherited from IModbusMessage.)


ProtocolDataUnit Composition of the function code
and message data.

(Inherited from IModbusMessage.)


SlaveAddress Address of the slave (server).
(Inherited from IModbusMessage.)
TransactionId A unique identifier assigned to a
message when using the IP
protocol.

(Inherited from IModbusMessage.)


ValidateResponse(IModbusMessage) Validate the specified response
against the current request.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ValidateResponse Method (response)
Namespaces ► Modbus.Message ► IModbusRequest ►
ValidateResponse(IModbusMessage)
C#
Validate the specified response against the current request.

Declaration Syntax
C# Visual Basic Visual C++
void ValidateResponse(
IModbusMessage response
)

Sub ValidateResponse ( _
response As IModbusMessage _
)

void ValidateResponse(
IModbusMessage^ response
)

Parameters
response (IModbusMessage)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Modbus.Utility Namespace
Namespaces ► Modbus.Utility C#

Modbus utility methods.

Declaration Syntax
C# Visual Basic Visual C++
namespace Modbus.Utility

Namespace Modbus.Utility

namespace Modbus.Utility

Types
All Types Classes Enumerations
Icon Type Description
DiscriminatedUnion<TA, A data type that can store one of two
TB> possible strongly typed options.

DiscriminatedUnionOption Possible options for DiscriminatedUnion


type

ModbusUtility Modbus utility methods.


NModbus DiscriminatedUnion<TA, TB> Class
Namespaces ► Modbus.Utility ► DiscriminatedUnion<TA, TB>
C#
A data type that can store one of two possible strongly typed options.

Declaration Syntax
C# Visual Basic Visual C++
public class DiscriminatedUnion<TA, TB>

Public Class DiscriminatedUnion(Of TA, TB)

generic<typename TA, typename TB>


public ref class DiscriminatedUnion

Generic Template Parameters


TA
The type of option A.
TB
The type of option B.

Members
All Members Constructors Methods Properties

Public Instance Declared


Protected Static
Inherited
Icon Member Description
DiscriminatedUnion<TA, TB> Initializes a new instance of the
() DiscriminatedUnion<TA, TB> class

A Gets the value of option A.

B Gets the value of option B.


CreateA(TA) Factory method for creating
DiscriminatedUnion with option A set.

CreateB(TB) Factory method for creating


DiscriminatedUnion with option B set.

Equals(Object) Determines whether the specified Object


is equal to the current Object.

(Inherited from Object.)


Finalize() Allows an Object to attempt to free
resources and perform other cleanup
operations before the Object is reclaimed
by garbage collection.

(Inherited from Object.)


GetHashCode() Serves as a hash function for a particular
type.

(Inherited from Object.)


GetType() Gets the Type of the current instance.

(Inherited from Object.)


MemberwiseClone() Creates a shallow copy of the current
Object.

(Inherited from Object.)


Option Gets the discriminated value option set
for this instance.

ToString() Returns a String that represents the


current Object.

(Overrides Object.ToString().)

Inheritance Hierarchy
Object

DiscriminatedUnion<TA, TB>

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DiscriminatedUnion<TA, TB> Constructor
Namespaces ► Modbus.Utility ► DiscriminatedUnion<TA, TB> ►
DiscriminatedUnion<TA, TB>()
C#
Initializes a new instance of the DiscriminatedUnion<TA, TB> class

Declaration Syntax
C# Visual Basic Visual C++
public DiscriminatedUnion()

Public Sub New

public:
DiscriminatedUnion()

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus A Property
Namespaces ► Modbus.Utility ► DiscriminatedUnion<TA, TB> ► A
C#
Gets the value of option A.

Declaration Syntax
C# Visual Basic Visual C++
public TA A { get; }

Public ReadOnly Property A As TA

public:
property TA A {
TA get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus B Property
Namespaces ► Modbus.Utility ► DiscriminatedUnion<TA, TB> ► B
C#
Gets the value of option B.

Declaration Syntax
C# Visual Basic Visual C++
public TB B { get; }

Public ReadOnly Property B As TB

public:
property TB B {
TB get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateA Method (a)
Namespaces ► Modbus.Utility ► DiscriminatedUnion<TA, TB> ►
CreateA(TA)
C#
Factory method for creating DiscriminatedUnion with option A set.

Declaration Syntax
C# Visual Basic Visual C++
public static DiscriminatedUnion<TA, TB> CreateA(
TA a
)

Public Shared Function CreateA ( _


a As TA _
) As DiscriminatedUnion(Of TA, TB)

public:
static DiscriminatedUnion<TA, TB>^ CreateA(
TA a
)

Parameters
a (TA)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CreateB Method (b)
Namespaces ► Modbus.Utility ► DiscriminatedUnion<TA, TB> ►
CreateB(TB)
C#
Factory method for creating DiscriminatedUnion with option B set.

Declaration Syntax
C# Visual Basic Visual C++
public static DiscriminatedUnion<TA, TB> CreateB(
TB b
)

Public Shared Function CreateB ( _


b As TB _
) As DiscriminatedUnion(Of TA, TB)

public:
static DiscriminatedUnion<TA, TB>^ CreateB(
TB b
)

Parameters
b (TB)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus Option Property
Namespaces ► Modbus.Utility ► DiscriminatedUnion<TA, TB> ► Option
C#
Gets the discriminated value option set for this instance.

Declaration Syntax
C# Visual Basic Visual C++
public DiscriminatedUnionOption Option { get; }

Public ReadOnly Property Option As DiscriminatedUnionOption

public:
property DiscriminatedUnionOption Option {
DiscriminatedUnionOption get ();
}

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ToString Method
Namespaces ► Modbus.Utility ► DiscriminatedUnion<TA, TB> ► ToString()
C#
Returns a String that represents the current Object.

Declaration Syntax
C# Visual Basic Visual C++
public override string ToString()

Public Overrides Function ToString As String

public:
virtual String^ ToString() override

Return Value
A String that represents the current Object.

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus DiscriminatedUnionOption Enumeration
Namespaces ► Modbus.Utility ► DiscriminatedUnionOption C#

Possible options for DiscriminatedUnion type

Declaration Syntax
C# Visual Basic Visual C++
public enum DiscriminatedUnionOption

Public Enumeration DiscriminatedUnionOption

public enum class DiscriminatedUnionOption

Members
Member Description
A Option A

B Option B

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus ModbusUtility Class
Namespaces ► Modbus.Utility ► ModbusUtility C#

Modbus utility methods.

Declaration Syntax
C# Visual Basic Visual C++
public static class ModbusUtility

Public NotInheritable Class ModbusUtility

public ref class ModbusUtility abstract sealed

Members
All Members Methods
Public Instance Declared
Protected Static Inherited
Icon Member Description
CalculateCrc(Byte[]) Calculate Cyclical Redundancy
Check

CalculateLrc(Byte[]) Calculate Longitudinal Redundancy


Check.

GetAsciiBytes(Byte[]) Converts an array of bytes to an


ASCII byte array

GetAsciiBytes(UInt16[]) Converts an array of UInt16 to an


ASCII byte array

GetSingle(UInt16, UInt16) Converts two UInt16 values into a


IEEE 32 floating point format
GetUInt32(UInt16, UInt16) Converts two UInt16 values into a
UInt32

HexToBytes(String) Converts a hex string to a byte


array.

NetworkBytesToHostUInt16(Byte[]) Converts a network order byte


array to an array of UInt16 values
in host order

Inheritance Hierarchy
Object
ModbusUtility

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CalculateCrc Method (data)
Namespaces ► Modbus.Utility ► ModbusUtility ► CalculateCrc(Byte[])
C#
Calculate Cyclical Redundancy Check

Declaration Syntax
C# Visual Basic Visual C++
public static byte[] CalculateCrc(
byte[] data
)

Public Shared Function CalculateCrc ( _


data As Byte() _
) As Byte()

public:
static array<unsigned char>^ CalculateCrc(
array<unsigned char>^ data
)

Parameters
data ( Byte [])
The data used in CRC

Return Value
CRC value

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus CalculateLrc Method (data)
Namespaces ► Modbus.Utility ► ModbusUtility ► CalculateLrc(Byte[])
C#
Calculate Longitudinal Redundancy Check.

Declaration Syntax
C# Visual Basic Visual C++
public static byte CalculateLrc(
byte[] data
)

Public Shared Function CalculateLrc ( _


data As Byte() _
) As Byte

public:
static unsigned char CalculateLrc(
array<unsigned char>^ data
)

Parameters
data ( Byte [])
The data used in LRC

Return Value
LRC value

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus GetAsciiBytes Method
Namespaces ► Modbus.Utility ► ModbusUtility ► GetAsciiBytes()
C#
Members
Icon Member Description
GetAsciiBytes(Byte[]) Converts an array of bytes to an ASCII
byte array

GetAsciiBytes(UInt16[]) Converts an array of UInt16 to an ASCII


byte array

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus GetAsciiBytes Method (numbers)
Namespaces ► Modbus.Utility ► ModbusUtility ► GetAsciiBytes(Byte[])
C#
Converts an array of bytes to an ASCII byte array

Declaration Syntax
C# Visual Basic Visual C++
public static byte[] GetAsciiBytes(
params byte[] numbers
)

Public Shared Function GetAsciiBytes ( _


ParamArray numbers As Byte() _
) As Byte()

public:
static array<unsigned char>^ GetAsciiBytes(
... array<unsigned char>^ numbers
)

Parameters
numbers ( Byte [])
The byte array

Return Value
An array of ASCII byte values

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus GetAsciiBytes Method (numbers)
Namespaces ► Modbus.Utility ► ModbusUtility ► GetAsciiBytes(UInt16[])
C#
Converts an array of UInt16 to an ASCII byte array

Declaration Syntax
C# Visual Basic Visual C++
public static byte[] GetAsciiBytes(
params ushort[] numbers
)

Public Shared Function GetAsciiBytes ( _


ParamArray numbers As UShort() _
) As Byte()

public:
static array<unsigned char>^ GetAsciiBytes(
... array<unsigned short>^ numbers
)

Parameters
numbers ( UInt16 [])
The ushort array

Return Value
An array of ASCII byte values

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


GetSingle Method (highOrderValue,
NModbus

lowOrderValue)
Namespaces ► Modbus.Utility ► ModbusUtility ► GetSingle(UInt16,
UInt16)
C#
Converts two UInt16 values into a IEEE 32 floating point format

Declaration Syntax
C# Visual Basic Visual C++
public static float GetSingle(
ushort highOrderValue,
ushort lowOrderValue
)

Public Shared Function GetSingle ( _


highOrderValue As UShort, _
lowOrderValue As UShort _
) As Single

public:
static float GetSingle(
unsigned short highOrderValue,
unsigned short lowOrderValue
)

Parameters
highOrderValue (UInt16)
High order ushort value
lowOrderValue (UInt16)
Low order ushort value

Return Value
IEEE 32 floating point value

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


GetUInt32 Method (highOrderValue,
NModbus

lowOrderValue)
Namespaces ► Modbus.Utility ► ModbusUtility ► GetUInt32(UInt16,
UInt16)
C#
Converts two UInt16 values into a UInt32

Declaration Syntax
C# Visual Basic Visual C++
public static uint GetUInt32(
ushort highOrderValue,
ushort lowOrderValue
)

Public Shared Function GetUInt32 ( _


highOrderValue As UShort, _
lowOrderValue As UShort _
) As UInteger

public:
static unsigned int GetUInt32(
unsigned short highOrderValue,
unsigned short lowOrderValue
)

Parameters
highOrderValue (UInt16)
lowOrderValue (UInt16)

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus HexToBytes Method (hex)
Namespaces ► Modbus.Utility ► ModbusUtility ► HexToBytes(String)
C#
Converts a hex string to a byte array.

Declaration Syntax
C# Visual Basic Visual C++
public static byte[] HexToBytes(
string hex
)

Public Shared Function HexToBytes ( _


hex As String _
) As Byte()

public:
static array<unsigned char>^ HexToBytes(
String^ hex
)

Parameters
hex (String)
The hex string

Return Value
Array of bytes

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NetworkBytesToHostUInt16 Method
NModbus

(networkBytes)
Namespaces ► Modbus.Utility ► ModbusUtility ►
NetworkBytesToHostUInt16(Byte[])
C#
Converts a network order byte array to an array of UInt16 values in host orde

Declaration Syntax
C# Visual Basic Visual C++
public static ushort[] NetworkBytesToHostUInt16(
byte[] networkBytes
)

Public Shared Function NetworkBytesToHostUInt16 ( _


networkBytes As Byte() _
) As UShort()

public:
static array<unsigned short>^ NetworkBytesToHostUInt16(
array<unsigned char>^ networkBytes
)

Parameters
networkBytes ( Byte [])
The network order byte array

Return Value
The host order ushort array

Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)


NModbus

Namespaces C#
NModbus is a C# 3.0 implementation of the Modbus protocol.

Namespaces
Namespace Description
FtdAdapter .NET wrapper for Future Device Technologies
USB driver. This assembly contains unsafe
code and must be run with full trust.

Modbus Modbus.

Modbus.Data Modbus data.

Modbus.Device Modbus device.

Modbus.IO Modbus transport IO.

Modbus.Message Modbus messages.

Modbus.Utility Modbus utility methods.

You might also like