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

Configures a Sealevel I/O module's programmable IO direction.

Parameters
[in]handleValid handle returned by SM_Open().
[in]configContains the direction (input or output) of the programmable IO.
Return values
>=0Successful completion.
-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.
-10SeaDAC Lite: Invalid model number.
-11SeaDAC Lite: Unknown connection type.
-12SeaDAC 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().

 
 
Generated on Mon Nov 26 2018.