IPC@CHIP Modbus library – API Documentation

Header image

Main page


int mbRTU_mst_rdwr_regs ( MbHandle  handle,
u8  slaveAddr,
u16  startAddressRd,
u16  quantityRd,
u16 registerDataRd,
u16  startAddressWr,
u16  quantityWr,
const u16 registerDataWr,
u8 exception,
u32  timeoutMs 
)

Send a "read/write multiple registers" request 17h and receive reply the slave.

Parameters:
[in] handle : Handle returned by mbRTU_mst_init()
[in] slaveAddr : Slave address
[in] startAddressRd : Address of the first register to read
[in] quantityRd : Number of registers to read
[out] registerDataRd : 16 bit buffer provided by user with min. length quantity
.   After execution registerDataRd 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 the first register (write)
[in] quantityWr : Number of registers to write
[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 from the slave.
Returns:

0 : Execution successful, check *exception for possible exception code.
-1 : Communication timeout receive
-2 : Received garbage (CRC error)
-3 : Unable to send request
-8 : Illegal parameter





Top of page | Main page

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