eMBRegDiscreteCB() function
Callback function used if a Input Discrete Register value is read by the protocol stack. If you are going to use his function you might use the functions xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields.
Arguments
pucRegBuffer
The buffer should be updated with the current coil values. The first discrete input starting at \c usAddress must be stored at the LSB of the first byte in the buffer. If the requested number is not a multiple of eight the remaining bits should be set to zero.
usAddress
The starting address of the first discrete input.
usNDiscrete
Number of discrete input values.
Return value
The function must return one of the following error codes: - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal Modbus response is sent. - eMBErrorCode::MB_ENOREG If no such discrete inputs exists. In this case a ILLEGAL DATA ADDRESS exception frame is sent as a response. - eMBErrorCode::MB_ETIMEDOUT If the requested register block is currently not available and the application dependent response timeout would be violated. In this case a SLAVE DEVICE BUSY exception is sent as a response. - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case a SLAVE DEVICE FAILURE exception is sent as a response.