int __stdcall SM_GetPIOPresets ( SM_HANDLE  handle,
unsigned char *  config 
)

Retrieves a Sealevel I/O module's programmable IO bit presets.

Parameters
[in]handleValid handle returned by SM_Open().
[in]configContains the presets ("on" or "off") of the programmable IO.
Return values
>=0Successful completion. Bytes successfully read.
-1Invalid SeaMAX handle.
-2Connection is not established. Check the provided Connection object state.
-3Read error waiting for response. Unknown Modbus exception.
-4Illegal Modbus Function (Modbus Exception 0x01).
-5Illegal Data Address (Modbus Exception 0x02).
-6Illegal Data Value (Modbus Exception 0x03).
-7Modbus 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:

dot_inline_dotgraph_22.png
Warning
The parameter config must have 12 bytes allocated before calling this method, even if the module has fewer than 96 bits of PIO.