Writes the IO space of a programmable I/O Sealevel I/O module.
- Parameters
-
[in] | handle | Valid handle returned by SM_Open(). |
[out] | values | Desired state of the Sealevel I/O module's inputs and outputs. |
- Return values
-
0 | Successful completion. |
-1 | Invalid SeaMAX handle. |
-2 | Connection is not established. Check the provided Connection object state. |
-3 | Read error waiting for response. Unknown Modbus exception. |
-4 | Illegal Modbus Function (Modbus Exception 0x01). |
-5 | Illegal Data Address (Modbus Exception 0x02). |
-6 | Illegal Data Value (Modbus Exception 0x03). |
-7 | Modbus CRC was invalid. Possible communications problem. |
-10 | SeaDAC Lite: Invalid model number. |
-11 | SeaDAC Lite: Unknown connection type. |
-12 | SeaDAC Lite: Error communicating with device. |
This method attempts to configure the state of all programmable IO. The data should be a packed array of bytes, in order of ports A1 to C4, MSB to LSB. For instance, a 96-bit PIO module would require a 12-byte array, packed as such:
values[0] = Port A1 (PIO 7 to 0 - MSB to LSB)
values[1] = Port B1 (PIO 15 to 8)
values[2] = Port C1 ...
values[3] = Port A2
...
values[11] = Port C4
- Note
- There is no need to segregate inputs and outputs within the values array. If any particular port is set as an input, rather than output, the corresponding byte in values will be ignored. Only ports which have been configured as outputs will be affected by this function. This function expects an array size of (the number of PIO / 8) bytes (e.g. 96 PIO would require 12 bytes).
- Warning
- This function requires an array size of (PIO / 8) bytes. Therefore, for a 96 programmable I/O module, 12 bytes of data would be required, and for a 32 I/O module only four is needed.
Referenced by CSeaMaxW32::Write().