Back to Sealevel      

int SM_ReadPIO ( SM_HANDLE  handle,
unsigned char *  values 
)

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

Parameters:
[in] handle Valid handle returned by SM_Open().
[out] values After completion, contains the state of the Sealevel I/O device's inputs and outputs.
Return values:
>0 Successful completion. Number of bytes of valid data in pioValues.
-1 Invalid SeaMAX handle.
-2 Connection is not established. Check the provided Connection object state.
-3 Read error waiting for response. Unkown 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.
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 paramater, 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 preallocated space.

 
 
Generated on 18 Sep 2007.