int __stdcall SM_CustomMessage ( SM_HANDLE  handle,
unsigned char *  message,
int  messageSize,
int  expectedBytes 
)

Sends a custom modbus message to the selected device, and retrieves the response.

Parameters
[in]handleValid handle returned by SM_Open().
[in]messageMessage to send beginning with the function code. It will also contain the response on success.
[in]messageSizeSize in bytes of the outgoing message. Must be less than 1017 bytes.
[in]expectedBytesSize in bytes of the expected response. Must be less than 1017 bytes.
Return values
>=0Number of bytes successfully read.
-1Invalid SeaMAX handle or connection type or invalid parameter.
-2Modbus: Connection is not established. Check the provided Connection object state.
-3Modbus: Read error waiting for response. Unknown Modbus exception.
-7Modbus CRC was invalid. Possible communications problem.

The message parameter should contain the function code and remaining bytes in the message. The header, the Slave ID and the CRC are not required because SeaMAX handles these elements of the message.

Note
The message parameter must contain an array large enough to hold the return message.
See also
http://www.modbus.org
 
 
Generated on Mon Nov 26 2018.