Back to Sealevel      

int SM_ReadDigitalInputs ( SM_HANDLE  handle,
int  start,
int  number,
unsigned char *  values 
)

Reads the current state of one or more digital inputs.

Parameters:
[in] handle Valid handle returned by SM_Open().
[in] start Starting input (zero-indexed).
[in] number Quantity of inputs to read.
[out] values Discrete input values.
Return values:
>=0 Number of bytes successfully returned in result array.
-1 Invalid SeaMAX handle.
-2 Modbus: Connection is not established. Check the provided Connection object state.
-3 Modbus: Read error waiting for response. Unkown Modbus exception.
-4 Modbus: Illegal Modbus Function (Modbus Exception 0x01).
-5 Modbus: Illegal Data Address (Modbus Exception 0x02).
-6 Modbus: Illegal Data Value (Modbus Exception 0x03).
-7 Modbus CRC was invalid. Possible communications problem.
-20 SeaDAC Lite: Invalid model number.
-21 SeaDAC Lite: Invalid addressing.
-22 SeaDAC Lite: Error reading the device.
Reads the state of one or more digital inputs. The digital input values in the values array (after a successful read) are packed as one input per bit. The LSB of the first byte (values[0]) contains the first addressed input. The next inputs follow toward the high order end of this byte, and then from low order to high order in subsequent bytes.

For instance, a read of 18 inputs would result in a three byte values array:

        values[0] = Input 7 to Input 0 (MSB to LSB)
        values[1] = Input 15 to Input 8
        values[2] = 6 Padding bits followed by Input 17 to Input 16
    

Warning:
The result array parameter should have enough allocated space, before calling this method, to hold 1 bit for every input requested.

 
 
Generated on 18 Sep 2007.