Configures a Sealevel I/O module's programmable IO direction.
- Parameters
-
[in] | handle | Valid handle returned by SM_Open(). |
[in] | config | Contains the direction (input or output) of the programmable IO. |
- 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 provides a simpler, easier way to interface to the programmable IO Sealevel I/O modules. The SeaI/O 462 & 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. The most basic way of configuring the programmable IO module is by subsequent reads and writes to it's holding register map. This method masks many of those reads and writes and provides one simple interface to set IO direction.
The format of the config parameter should be one byte for every 8 bits of programmable I/O, each byte representing banks 1 - 12. A non-zero byte indicates that the corresponding bank of PIO should be a bank of 8 inputs, zero indicating 8 outputs. For example, a non-zero value in config[3] would indicate that bank 4 should be a bank of inputs.
- Warning
- When changing the direction of any PIO bank from input to output, or vice versa, it is worth mentioning that all banks set as output will reset to their previously saved, default preset state (if applicable - see SM_SetPIOPresets()). For devices that do not support presets, their output banks will reset to an inactive state.
Referenced by CSeaMaxW32::Ioctl().