hil_close_all hil_set_analog_input_ranges navigation bar

Table of Contents

hil_set_analog_input_configuration

Sets the configuration of the analog inputs.

Description

The hil_set_analog_input_configuration function sets the configuration of the specified analog input channels. Only configurations supported by the board may be specified. Invalid configurations will generate an error. Refer to the documentation for your card for details on the features supported by the card. The configurations currently supported are:

ANALOG_INPUT_RSE_CONFIGURATION

-

The input is referenced single-ended.

ANALOG_INPUT_NRSE_CONFIGURATION

-

The input is non-referenced single-ended.

ANALOG_INPUT_DIFF_CONFIGURATION

-

The input is differential.

ANALOG_INPUT_PDIFF_CONFIGURATION

-

The input is pseudo-differential.

Prototype

t_error
hil_set_analog_input_configuration(t_card card, const t_uint32 analog_channels[], t_uint32 num_channels,
                                   const t_analog_input_configuration configs[]);
    

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 input channels whose configurations will be changed. 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_analog_input_configuration * configs

An array containing the configuration of the analog inputs. The array must contain num_channels elements. Each element in the configs array corresponds to the same element in the analog_channels array.

Return value

The return value is 0 if the analog inputs 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_CONFIGURATION_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_INPUT_CHANNELS

Too many analog input channels were specified.

QERR_INVALID_ANALOG_INPUT_CHANNEL

One of the analog input 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_INPUTS

The array of analog input channels is NULL even though the number of analog inputs specified is non-zero.

QERR_MISSING_ANALOG_INPUT_CONFIGURATION

The array of configuration values is NULL even though the number of channels specified is non-zero.

QERR_INVALID_ANALOG_INPUT_CONFIGURATION

One of the configurations specified for an analog input channel is not valid for the selected hardware.

Requirements

Include Files

Libraries

hil.h

hil.lib;quanser_runtime.lib;quanser_common.lib

Examples

/*
* Set channel 0 to referenced single-ended, channel 3 to differential and channel 4 to non-referenced single-ended.
*/
t_uint32 channels[] = {  0,  3,  5 };
t_analog_input_configuration configurations[] = {
    ANALOG_INPUT_RSE_CONFIGURATION,
    ANALOG_INPUT_DIFF_CONFIGURATION,
    ANALOG_INPUT_NRSE_CONFIGURATION
};
t_error result = hil_set_analog_input_configuration(card, channels, ARRAY_LENGTH(channels), configurations);
    

See Also

 

navigation bar