eMBMasterRegCoilsCB() function
Callback function used if a Coil Register value is read or written by the protocol stack. If you are going to use this function you might use the functions xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields.
Arguments
pucRegBuffer
The bits are packed in bytes where the first coil starting at address \c usAddress is stored in the LSB of the first byte in the buffer pucRegBuffer. If the buffer should be written by the callback function unused coil values (I.e. if not a multiple of eight coils is used) should be set to zero.
usAddress
The first coil number.
usNCoils
Number of coil values requested.
eMode
If eMBRegisterMode::MB_REG_WRITE the application values should be updated from the values supplied in the buffer \c pucRegBuffer. If eMBRegisterMode::MB_REG_READ the application should store the current values in the buffer \c pucRegBuffer.
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 the application does not map an coils within the requested address range. In this case a ILLEGAL DATA ADDRESS is sent as a response.