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

Reads the entire I/O space of a Sealevel programmable IO device.

Parameters
[in]handleValid handle returned by SM_Open().
[out]valuesAfter completion, contains the state of the Sealevel I/O device's inputs and outputs.
Return values
>0Successful completion. Number of bytes of valid data in pioValues.
-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 read the state of the programmable IO for any applicable Sealevel I/O module. The data is returned as a packed array of bytes reflecting the state of ports A1 to C4, MSB to LSB. For instance, a 96-bit PIO module would return 12 bytes of packed data 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[4] = Port B2
             ...
    values[11] = Port C4
Warning
The parameter, values, must have at least one bytes of space allocated for each bank of 8 I/O points before calling this function. For instance, a SeaDAC Lite module with 32 PIO would require 4 bytes of pre-allocated space.

Referenced by CSeaMaxW32::Read().

 
 
Generated on Mon Nov 26 2018.