int __stdcall SM_ReadDigitalOutputs ( SM_HANDLE  handle,
int  start,
int  number,
unsigned char *  values 
)

Reads the current state of one or more digital outputs.

Parameters
[in]handleValid handle returned by SM_Open().
[in]startStarting output to read (zero-indexed).
[in]numberQuantity of outputs to read.
[out]valuesOutput state(s).
Return values
>=0Number of bytes successfully returned in result array.
-1Invalid SeaMAX handle.
-2Modbus: Connection is not established. Check the provided Connection object state.
-3Modbus: Read error waiting for response. Unknown Modbus exception.
-4Modbus: Illegal Modbus Function (Modbus Exception 0x01).
-5Modbus: Illegal Data Address (Modbus Exception 0x02).
-6Modbus: Illegal Data Value (Modbus Exception 0x03).
-7Modbus CRC was invalid. Possible communications problem.
-20SeaDAC Lite: Invalid model number.
-21SeaDAC Lite: Invalid addressing.
-22SeaDAC Lite: Error reading the device.

Reads the state of one or more digital outputs. The output state(s) parameter will be an array of bytes where each byte represents 8 outputs and their states. The LSB of the first byte (values[0]) will contain the first 8 output states and will be ordered from LSB to MSB.

For instance, a read of 18 outputs (starting at output 0) will be an array of three bytes as such:

    values[0] = Outputs 7 to 0 (MSB to LSB)
    values[1] = Outputs 15 to 8 (MSB to LSB)
    values[2] = 6 padded bits followed by outputs 17 - 16.
Warning
The result array parameter should have enough allocated space, before calling this method, to hold 1 bit for every coil requested.

Referenced by SM_ReadCoils().

 
 
Generated on Mon Nov 26 2018.