Reads the current state of one or more digital outputs.
- Parameters
-
[in] | handle | Valid handle returned by SM_Open(). |
[in] | start | Starting output to read (zero-indexed). |
[in] | number | Quantity of outputs to read. |
[out] | values | Output state(s). |
- Return values
-
>=0 | Number of bytes successfully returned in result array. |
-1 | Invalid SeaMAX handle. |
-2 | Modbus: Connection is not established. Check the provided Connection object state. |
-3 | Modbus: Read error waiting for response. Unknown Modbus exception. |
-4 | Modbus: Illegal Modbus Function (Modbus Exception 0x01). |
-5 | Modbus: Illegal Data Address (Modbus Exception 0x02). |
-6 | Modbus: Illegal Data Value (Modbus Exception 0x03). |
-7 | Modbus CRC was invalid. Possible communications problem. |
-20 | SeaDAC Lite: Invalid model number. |
-21 | SeaDAC Lite: Invalid addressing. |
-22 | SeaDAC 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().