int __stdcall SM_ReadAnalogOutputs ( SM_HANDLE  handle,
int  start,
int  number,
double *  analogValues,
unsigned char *  ranges,
unsigned char *  byteValues 
)

Reads one or more Sealevel I/O device analog output(s).

Parameters
[in]handleValid handle returned by SM_Open().
[in]startStarting output.
[in]numberQuantity of analog outputs to read.
[out]analogValuesOutput values as floating point values (voltages).
[in]rangesArray of channel ranges that correspond directly to each requested output.
[out]byteValuesRegister state values as 16-bit byte pairs.
Return values
>=0Number of bytes successfully returned in result array.
-1Invalid SeaMAX handle.
-2Both 'byteValues' or 'analogValues' are null. Supply either one or both.
-3If an array of doubles is supplied, a similar array of analog output ranges must also be supplied.
-4One or more of the analog output ranges in the 'ranges' array is invalid.
-5Connection is not established. Check the provided Connection object state.
-6Read error waiting for response. Unknown Modbus exception.
-7Illegal Modbus Function (Modbus Exception 0x01).
-8Illegal Data Address (Modbus Exception 0x02).
-9Illegal Data Value (Modbus Exception 0x03).
-10Modbus CRC was invalid. Possible communications problem.

Reads one or more analog outputs. There are two ways that the analog output values can be returned: an array of 16-bit byte values, or as an array of double (floating-point) values.

Note
This function will return, via parameters, either an array of bytes, an array of doubles, or both. If you pass either the byte array or double array as null, that type of data will not be returned.

Double Array - Voltage Values

If an array of doubles is supplied, the array must contain at least one double for each analog output requested. The array will be filled with floating point voltage values after a successful completion. An array of analog output ranges is also required to convert the device's response to appropriate floating point values. The ranges array must have one byte corresponding to an appropriate channel range for each output requested. For instance, if three analog outputs are requested starting at output 2, the ranges array should contain:

    ranges[0] = Output 2 Channel Range
    ranges[1] = Output 3 Channel Range
    ranges[2] = Output 4 Channel Range

The channel ranges for analog outputs are hardware specific. Additionally, some hardware supports manual configuration via DIP switches.

Byte Array - 16-bit Byte Values

If an array of bytes is supplied, the array must contain at least two bytes for every analog output request. If only a byte array is supplied, the ranges parameter is not required. The byte array will be filled with the two byte values read directly from the analog I/O device. The byte order is such that the high-byte always comes first. For instance, if two analog outputs are read starting at output 4, the byte array returned will contain:

    byteValues[0] = Output 4 (High Byte)
    byteValues[1] = Output 4 (Low Byte)
    byteValues[2] = Output 5 (High Byte)
    byteValues[3] = Output 5 (Low Byte)
Warning
If a doubles array is supplied, it should contain space allocated for one double for each of the analog outputs requested. If a byte array is supplied, it should contain two bytes of space allocated for each output.
 
 
Generated on Mon Nov 26 2018.