int CSeaMaxW32::Read ( slave_address_t  slave_id,
seaio_type_t  type,
address_loc_t  starting_address,
address_range_t  range,
void *  data 
)

Performs a Modbus read on an opened SeaI/O module and returns the data by reference.

Deprecated:
Version 2.x
Parameters
[in]slave_idSlave ID of the target module
[in]typeType of read to complete
[in]starting_addressAddress to begin reading
[in]rangeNumber of I/O points to read
[out]dataData pointer
Return values
>=0Success - the number of valid data bytes in the buffer.
-14A Modbus read exception has occured - the first byte of the data buffer contains the exception.
-22A null pointer has been supplied where a pointer to a data buffer was expected.
-9The specified communication is not current established.
-19The SeaI/O module did not respond.

Read performs a Modbus read on an opened SeaI/O module and returns the data by reference.

The actual Modbus read type is specified by the 'type' argument. Since Modbus is one-indexed, the starting location should be no less than one. Likewise, the range indicates how many consecutive inputs should be read.

The final parameter, 'data', is a pointer to a buffer in which to store the returned data - most often, an array of bytes. Consult the provided code examples for model specific information.

Note
The following are deviations from SeaMAX v2:
  • The SETUPREG and COMMREG options are not supported and will return -1.

References SM_GetConfig(), SM_GetPIODirection(), SM_ReadCoils(), SM_ReadDiscreteInputs(), SM_ReadHoldingRegisters(), SM_ReadInputRegisters(), SM_ReadPIO(), and SM_SelectDevice().

 
 
Generated on Mon Nov 26 2018.