int __stdcall SM_WritePIO ( SM_HANDLE  handle,
unsigned char *  values 
)

Writes the IO space of a programmable I/O Sealevel I/O module.

Parameters
[in]handleValid handle returned by SM_Open().
[out]valuesDesired state of the Sealevel I/O module's inputs and outputs.
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 attempts to configure the state of all programmable IO. The data should be a packed array of bytes, in order of ports A1 to C4, MSB to LSB. For instance, a 96-bit PIO module would require a 12-byte array, packed as such:

    values[0] = Port A1 (PIO 7 to 0 - MSB to LSB)
    values[1] = Port B1 (PIO 15 to 8)
    values[2] = Port C1     ...
    values[3] = Port A2
            ...
    values[11] = Port C4
Note
There is no need to segregate inputs and outputs within the values array. If any particular port is set as an input, rather than output, the corresponding byte in values will be ignored. Only ports which have been configured as outputs will be affected by this function. This function expects an array size of (the number of PIO / 8) bytes (e.g. 96 PIO would require 12 bytes).
Warning
This function requires an array size of (PIO / 8) bytes. Therefore, for a 96 programmable I/O module, 12 bytes of data would be required, and for a 32 I/O module only four is needed.

Referenced by CSeaMaxW32::Write().

 
 
Generated on Mon Nov 26 2018.