FieldTalk Modbus Master Library, Delphi Edition  Library version 2.12.0
Device and Vendor Specific Modbus Functions

Custom Function Codes

 customFunction (integer slaveAddr, integer functionCode, byte []requestArr, byte []responseArr, integer &responseLen)
 User Defined Function CodeThis method can be used to implement User Defined Function Codes. More...
 

Advantec ADAM 5000/6000 Series Commands

 adamSendReceiveAsciiCmd (string command, string &response)
 Send/Receive ADAM 5000/6000 ASCII command. More...
 

Detailed Description

Some device specific or vendor specific functions and enhancements are supported.

Function Documentation

◆ customFunction()

customFunction ( integer  slaveAddr,
integer  functionCode,
byte []  requestArr,
byte []  responseArr,
integer &  responseLen 
)

User Defined Function CodeThis method can be used to implement User Defined Function Codes.

The caller has only to pass the user data to this function. The assembly of the Modbus frame (the so called ADU) including checksums, slave address and function code and subsequentially the transmission, is taken care of by this method.

The modbus specification reserves function codes 65-72 and 100-110 for user defined functions.

Note
Modbus functions usually have an implied response length and therefore the number of bytes expected to be received is known at the time when sending the request. In case of a custom Modbus function with an open or unknown response length, this function can not be used.
Parameters
slaveAddrModbus address of slave device or unit identifier (Range: 0 - 255)
functionCodeCustom function code to be used for Modbus transaction (1-127)
requestArrBuffer with data sent as request (not including slave address or function code). The length of the array determines how many bytes sent. (Range: 0-252)
responseArrBuffer which will be filled with the data bytes read.
responseLenLength of response data (0-252). The number of bytes expected to be sent as response must be known when submitting the request.
Exceptions
EIllegalStateErrorPort or connection is closed
EInOutErrorAn I/O error occurred
EIllegalArgumentErrorA parameter is out of range
EBusProtocolExceptionA protocol failure occurred. See descendants of EBusProtocolException for a more detailed failure list.
Note
No broadcast supported

◆ adamSendReceiveAsciiCmd()

adamSendReceiveAsciiCmd ( string  command,
string &  response 
)

Send/Receive ADAM 5000/6000 ASCII command.

Sends an ADAM 5000/6000 ASCII command to the device and receives the reply as ASCII string. (e.g. "$01M" to retrieve the module name)

Parameters
commandCommand string. Must not be longer than 255 characters.
responseResponse string. A possible trailing CR is removed.
Exceptions
EIllegalArgumentErrorA parameter is out of range
Note
No broadcast supported