MODBUS Functions


Detailed Description

Implementation of MODBUS functions. Every MODBUS function is passed a buffer to the MODBUS PDU which can be read or written and a structure which holds pointers to callback functions to provide acutal register values. Custom function codes are only passed the MODBUS PDU and its actual length.


Typedefs

typedef eMBException(* peMBSCustomFunctionCB )(UBYTE *pubMBPDU, USHORT *pusMBPDULength) MB_CDECL_SUFFIX


Typedef Documentation

typedef eMBException( * peMBSCustomFunctionCB)(UBYTE *pubMBPDU, USHORT *pusMBPDULength) MB_CDECL_SUFFIX
 

Callback function for custom function codes.

If a custom MODBUS function code should be implemented a callback function can be registered. The function is called by the MODBUS stack whenever such a function is encountered.

Parameters:
pubMBPDU The MODBUS request sent by the MODBUS master which is pusMBPDULength bytes long. The response should be written into the same buffer and the length of the response should be written to pubMBPDULength. It must not exceed the size of 243 bytes.
pubMBPDULen Length of the MODBUS PDU.
Returns:
If the function returns eMBException::MB_PDU_EX_NONE a response is sent to the master with a length of pusMBPDULength and the contents of pubMBPDU. Otherwise an exception frame is generated.


(C) 2007 Embedded Solutions. Last updated on 27 Aug 2016.