IPC@CHIP Modbus library – API Documentation

Header image

Main page

int mbTCP_cl_rdwr_regs_packed ( MbHandle  handle,
u8  unitId,
u16  startAddressRd,
u16  quantityRd,
u8 registerDataRd,
u16  startAddressWr,
u16  quantityWr,
const u8 registerDataWr,
u8 exception,
u32  timeoutMs,
int *  errorCode 

Send a "read/write multiple registers" request 17h and receive the reply from the server in a packed manner.

[in] handle : Handle returned by mbTCP_cl_init()
[in] unitId : Unit identifier
[in] quantityRd : Number of registers to read
[in] startAddressRd : Address of first register
[out] registerDataRd : 16 bit buffer provided by user with min. length quantity
  After execution, registerData contains the read register values , if *exception code==0
  registerDataRd[0] == value of lowest register address,
  registerDataRd[quantityRd-1] holds highest register value.
[in] startAddressWr : Address of first register
[in] quantityWr : Number of registers to change
[in] registerDataWr : User provided storage, contains register values to write
[out] exception : Exception code (see ModbusExceptionCodes).
[in] timeoutMs : Wait max. timeout in [ms] for a reply.
[out] errorCode : Socket API error code
0 : Execution successful, check *exception for possible exception code.
-1 : Timeout, no reply received
-2 : Received garbage (invalid Modbus frame data)
-5 : TCP socket fault, see errorCode

Top of page | Main page

Copyright © 2017 Beck IPC GmbH
Generated on Thu Mar 9 18:00:33 2017 by Doxygen 1.6.1