Show / Hide Table of Contents

Class ModbusUtility

Modbus utility methods.

Inheritance
System.Object
ModbusUtility
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: NModbus.Utility
Assembly: NModbus.dll
Syntax
public static class ModbusUtility

Methods

| Improve this Doc View Source

CalculateCrc(Byte[])

Calculate Cyclical Redundancy Check.

Declaration
public static byte[] CalculateCrc(byte[] data)
Parameters
Type Name Description
System.Byte[] data

The data used in CRC.

Returns
Type Description
System.Byte[]

CRC value.

| Improve this Doc View Source

CalculateLrc(Byte[])

Calculate Longitudinal Redundancy Check.

Declaration
public static byte CalculateLrc(byte[] data)
Parameters
Type Name Description
System.Byte[] data

The data used in LRC.

Returns
Type Description
System.Byte

LRC value.

| Improve this Doc View Source

GetAsciiBytes(Byte[])

Converts an array of bytes to an ASCII byte array.

Declaration
public static byte[] GetAsciiBytes(params byte[] numbers)
Parameters
Type Name Description
System.Byte[] numbers

The byte array.

Returns
Type Description
System.Byte[]

An array of ASCII byte values.

| Improve this Doc View Source

GetAsciiBytes(UInt16[])

Converts an array of UInt16 to an ASCII byte array.

Declaration
public static byte[] GetAsciiBytes(params ushort[] numbers)
Parameters
Type Name Description
System.UInt16[] numbers

The ushort array.

Returns
Type Description
System.Byte[]

An array of ASCII byte values.

| Improve this Doc View Source

GetDouble(UInt16, UInt16, UInt16, UInt16)

Converts four UInt16 values into a IEEE 64 floating point format.

Declaration
public static double GetDouble(ushort b3, ushort b2, ushort b1, ushort b0)
Parameters
Type Name Description
System.UInt16 b3

Highest-order ushort value.

System.UInt16 b2

Second-to-highest-order ushort value.

System.UInt16 b1

Second-to-lowest-order ushort value.

System.UInt16 b0

Lowest-order ushort value.

Returns
Type Description
System.Double

IEEE 64 floating point value.

| Improve this Doc View Source

GetSingle(UInt16, UInt16)

Converts two UInt16 values into a IEEE 32 floating point format.

Declaration
public static float GetSingle(ushort highOrderValue, ushort lowOrderValue)
Parameters
Type Name Description
System.UInt16 highOrderValue

High order ushort value.

System.UInt16 lowOrderValue

Low order ushort value.

Returns
Type Description
System.Single

IEEE 32 floating point value.

| Improve this Doc View Source

GetUInt32(UInt16, UInt16)

Converts two UInt16 values into a UInt32.

Declaration
public static uint GetUInt32(ushort highOrderValue, ushort lowOrderValue)
Parameters
Type Name Description
System.UInt16 highOrderValue
System.UInt16 lowOrderValue
Returns
Type Description
System.UInt32
| Improve this Doc View Source

HexToBytes(String)

Converts a hex string to a byte array.

Declaration
public static byte[] HexToBytes(string hex)
Parameters
Type Name Description
System.String hex

The hex string.

Returns
Type Description
System.Byte[]

Array of bytes.

| Improve this Doc View Source

NetworkBytesToHostUInt16(Byte[])

Converts a network order byte array to an array of UInt16 values in host order.

Declaration
public static ushort[] NetworkBytesToHostUInt16(byte[] networkBytes)
Parameters
Type Name Description
System.Byte[] networkBytes

The network order byte array.

Returns
Type Description
System.UInt16[]

The host order ushort array.

  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX