hil_set_analog_output_ranges
Sets the ranges of the analog outputs.
Description
The hil_set_analog_output_ranges function sets the ranges of the analog outputs. Not all cards support programmable output ranges. Some cards only allow the ranges of all outputs to be set to the same value, rather than allowing each analog output to have a separate output range. Refer to the documentation for your card for details on the features supported by the card.
The units for the minimum and maximum values are typically Volts, but may be Amps or a unit appropriate to the specific card.
Prototype
t_error hil_set_analog_output_ranges(t_card card, const t_uint32 analog_channels[], t_uint32 num_channels, const t_double minimums[], const t_double maximums[]);
Parameters
t_card card
A handle to the board, as returned by hil_open.
const t_uint32 * analog_channels
An array containing the numbers of the analog output channels whose ranges will be configured. Channel numbers are zero-based. Thus, channel 0 is the first channel, channel 1 the second channel, etc.
Select a board type from the list for board-specific details: .
t_uint32 num_channels
The number of channels specified in the analog_channels, minimums and maximums arrays.
const t_double * minimums
An array of doubles (t_double) containing the minimum value of the output range for the corresponding channel in the analog_channels array. This array must be the same size as the analog_channels array.
const t_double * maximums
An array of doubles (t_double) containing the maximum value of the output range for the corresponding channel in the analog_channels array. This array must be the same size as the analog_channels array.
Return value
The return value is 0 if the analog output ranges are configured successfully. Otherwise a negative
error code is returned. Error codes are
defined in quanser_errors.h
. A suitable error message
may be retrieved using msg_get_error_message.
Error codes
QERR_HIL_SET_ANALOG_INPUT_RANGES_NOT_SUPPORTED
This function is not supported by the board-specific HIL driver for this board type.
QERR_INVALID_CARD_HANDLE
An invalid card handle was passed as an argument. Once a card has been closed using hil_close the card handle is invalid.
QERR_TOO_MANY_ANALOG_OUTPUT_CHANNELS
Too many analog output channels were specified.
QERR_INVALID_ANALOG_OUTPUT_CHANNEL
One of the analog output channels that was specified is not a valid channel number. Channel numbers range from 0 to one less than the number of channels.
QERR_MISSING_ANALOG_OUTPUTS
The array of analog output channels is NULL even though the number of analog outputs specified is non-zero.
QERR_MISSING_ANALOG_MINIMUMS
The array of minimum values is NULL even though the number of channels specified is non-zero.
QERR_MISSING_ANALOG_MAXIMUMS
The array of maximum values is NULL even though the number of channels specified is non-zero.
Requirements
Include Files |
Libraries |
---|---|
hil.h |
hil.lib;quanser_runtime.lib;quanser_common.lib |
Examples
/*
* Set the range of analog output #0 to ±10V, the range of analog output #3 to 0..5V
* and the range of output #5 to ±5V.
*/
t_uint32 channels[] = { 0, 3, 5 };
t_double minimums[] = { -10, 0, -5 };
t_double maximums[] = { +10, 5, +5 };
t_error result = hil_set_analog_output_ranges(card, channels, ARRAY_LENGTH(channels), minimums, maximums);
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.