Retrieves a Sealevel I/O module's programmable IO bit presets.
- Parameters
-
[in] | handle | Valid handle returned by SM_Open(). |
[in] | config | Contains the presets ("on" or "off") of the programmable IO. |
- Return values
-
>=0 | Successful completion. Bytes successfully read. |
-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. |
The SeaI/O 462 and 463 modules offer 96 bits of programmable IO in 12 banks, each of which may be configured as a bank of 8 inputs or 8 outputs. For those banks configured as outputs, the module must know the state of the IO on power-up or on direction change (from input to output).
The format of the returned config
parameter is twelve (12) bytes, with each bit representing a bit in a PIO bank. The first byte configures the bit presets for PIO 1-8 (LSB to MSB) of bank 1, the second byte configures PIO 1-8 of bank 2, etc. In each byte's case, a "0" bit indicates the corresponding IO should be preset as "off", and a "1" indicates an "on" state.
The following illustrates the format:
- Warning
- The parameter
config
must have 12 bytes allocated before calling this method, even if the module has fewer than 96 bits of PIO.