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

Reads the current state of one or more digital inputs.

Parameters
[in]handleValid handle returned by SM_Open().
[in]startStarting input (zero-indexed).
[in]numberQuantity of inputs to read.
[out]valuesDiscrete input values.
Return values
>=0Number of bytes successfully returned in result array.
-1Invalid SeaMAX handle.
-2Modbus: Connection is not established. Check the provided Connection object state.
-3Modbus: Read error waiting for response. Unknown Modbus exception.
-4Modbus: Illegal Modbus Function (Modbus Exception 0x01).
-5Modbus: Illegal Data Address (Modbus Exception 0x02).
-6Modbus: Illegal Data Value (Modbus Exception 0x03).
-7Modbus CRC was invalid. Possible communications problem.
-20SeaDAC Lite: Invalid model number.
-21SeaDAC Lite: Invalid addressing.
-22SeaDAC 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.

Referenced by SM_ReadDiscreteInputs().

 
 
Generated on Mon Nov 26 2018.