Configures 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 written. |
| -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. |
This method provides a simpler, easier way to interface to the programmable IO Sealevel I/O modules. 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 config parameter should be a packed set of twelve (12) bytes, with each bit representing a bit in a bank of 12 8-bit programmable IO points. The configuration bytes are arranged such that the first byte configures the bit presets for IO 1-8 (LSB to MSB) of bank 1, the second byte configures IO 1-8 of bank 2, etc. In each bytes case, a bitwise "0" indicates the corresponding IO should be preset as "off", and a bitwise "1" indicates an "on" state. The following illustrates the format:
- Note
- This function has currently no effect on SeaDAC Lite modules.
- Warning
- The parameter
config must have 12 bytes allocated before calling this method, even if the module has fewer than 96 bits of PIO.