Start of trail hil_watchdog_set_pwm_expiration_state navigation bar

hil_watchdog_set_analog_expiration_state

Sets the state that the analog outputs will be set to if the watchdog expires.

Description

The hil_watchdog_set_analog_expiration_state function sets the state that the analog outputs will be set to if the watchdog expires. Most cards do not allow this state to be configured. The expiration states must be set prior to starting the watchdog timer using hil_watchdog_start.

The Quanser Q8-series cards may be configured to reset the analog outputs to 0V. In this case, the digital outputs must also be configured to go tristate. If no expiration states are configured for the Q8-series, then the analog and digital outputs will not be reconfigured when the watchdog expires.

Prototype

t_error
hil_watchdog_set_analog_expiration_state(t_card card, const t_uint channels[], t_uint num_channels, const t_double voltages[]);
    

Parameters

t_card card

A handle to the board, as returned by hil_open .

const t_uint32 [] channels

An array containing the numbers of the analog output channels for which the expiration state should be set. 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 channels array.

const t_double [] voltages

An array containing the analog voltages to which to set the corresponding channel in the analog_channels array upon watchdog expiration. This array must be the same size as the analog_channels array.

Return value

The return value is 0 if the analog expiration states 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_WATCHDOG_SET_ANALOG_EXPIRATION_STATE_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_OUTPUT_BUFFER

The array of voltages 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


/*
* Configure the first three analog outputs to go to 0V upon watchdog expiration.
*/

t_uint32 channels[] = {  0, 1, 2 };
t_double voltages[] = {  0, 0, 0 };
t_error  result = hil_watchdog_set_analog_expiration_state(card, channels, ARRAY_LENGTH(channels), voltages);
    

 

navigation bar