• Libraries
  • Shop
  • Doc
  • Free Modbus
  • Support
  • Login
FieldTalk Modbus Master C++ Library  Library version 2.13.3
  • Introduction
  • Chapters
  • Modules
  • Classes
Device and Vendor Specific Modbus Functions

Custom Function Codes

int customFunction (int slaveAddr, int functionCode, void *requestData, size_t requestLen, void *responseData, size_t *responseLenPtr)
 User Defined Function CodeThis method can be used to implement User Defined Function Codes. More...
 

Advantec ADAM 5000/6000 Series Commands

int adamSendReceiveAsciiCmd (const char *const commandSz, char *responseSz)
 Send/Receive ADAM 5000/6000 ASCII command. More...
 

Detailed Description

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

Function Documentation

◆ customFunction()

int customFunction ( int  slaveAddr,
int  functionCode,
void *  requestData,
size_t  requestLen,
void *  responseData,
size_t *  responseLenPtr 
)

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: 1 - 255 for serial, 0 - 255 for TCP)
functionCodeCustom function code to be used for Modbus transaction (1-127)
requestDataPointer to data sent as request (not including slave address or function code)
requestLenLength of request data structure (0-252)
responseDataPointer to data structure which holds response data
responseLenPtrLength of response data buffer (0-252). This value will be adjusted should the actual response data be less. A FTALK_INSUFFICIENT_BUFFER error code will be returned in case the allocated buffer size was insufficient.
Returns
FTALK_SUCCESS on success or error code. See Error Management for a list of error codes.

References FTALK_ILLEGAL_ARGUMENT_ERROR.

◆ adamSendReceiveAsciiCmd()

int adamSendReceiveAsciiCmd ( const char *const  commandSz,
char *  responseSz 
)

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
commandSzBuffer which holds command string. Must not be longer than 255 characters.
responseSzBuffer which holds response string. Must be a buffer of 256 bytes. A possible trailing CR is removed.
Returns
FTALK_SUCCESS on success or error code. See Error Management for a list of error codes.
Note
No broadcast supported

References FTALK_CONNECTION_WAS_CLOSED, FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_IO_ERROR, and FTALK_SUCCESS.

  • FieldTalk Modbus Master C++ Library Library version 2.13.3
Speak to the Experts
Modbus Organization Member logo

We are member of the Modbus Organization, Inc.

Buy with Confidence
30-day money back guarantee All our FieldTalk web sales are backed by a 30-day Money Back Guarantee.
We Accept
Bank VISA MasterCard PayPal
Customer Info
  • Info & Contact
  • Customer Login
  • Terms of Service
  • Terms of Sale
  • Privacy Policy
© 2005-2025 proconX Pty Ltd. All rights reserved. proconX and FieldTalk are trademarks of proconX Pty Ltd.
All other trademarks and registered trademarks appearing on www.modbusdriver.com are the property of their respective owners.