Click or drag to resize

ModbusTCPProtocolSendCommand(Byte) Method

Send a ModbusTCP command (ADU) to a Brainboxes Device and return response The MBAP header is handled internally by this class, only the function and data need to be sent as a command Any spacing is ignore, commands as encoded hex byte array e.g. 0x0100000001 Modbus TCP commands are defined as follows: ADU: Application Data Unit, split into: MBAP and PDU MBAP Header - the header contains 4 fields: * transactionId (2 bytes) = id starting at 01 increments by 1 for each new ADU sent * protocol Id (2 bytes) = always 0x00 = modbus for brainboxes devices * Length (2 bytes) = the total length in bytes of rest of the ADU from that point * Unit Id (1 byte) = set by the client in the request the response must contain the same data, always 0xff PDU: Protocol Data Unit, consists of 2 fields: Function Code (2 bytes)- the type of function requested can be: * 0x01 = Read Coils * 0x02 = Read Discrete Inputs * 0x03 = Read Holding Registers * 0x04 = Read Input Registers * 0x05 = Write Single Coil * 0x06 = Write Single Register Data (variable length) - The end of the modbusTCP command, which contains data relevant to the function code The format of the command is hex encoded values in ASCII,

Namespace: Brainboxes.IO
Assembly: Brainboxes.IO (in Brainboxes.IO.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public byte[] SendCommand(
	byte[] pdu
)

Parameters

pdu  Byte
Protocol Data Unit: Function Code and Data of the Modbus TCP command

Return Value

Byte
response from the ED device without modbus header MBAP
See Also