eMBMasterRegHoldingCB() function
Callback function used if a Holding Register value is read or written by the protocol stack. The starting register address is given by \c usAddress and the last register is given by usAddress + usNRegs - 1.
Arguments
pucRegBuffer
If the application registers values should be updated the buffer points to the new registers values. If the protocol stack needs to now the current values the callback function should write them into this buffer.
usAddress
The starting address of the register.
usNRegs
Number of registers to read or write.
eMode
If eMBRegisterMode::MB_REG_WRITE the application register values should be updated from the values in the buffer. For example this would be the case when the Modbus master has issued an WRITE SINGLE REGISTER command. If the value eMBRegisterMode::MB_REG_READ the application should copy the current values into 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.