Table of Contents
hil_set_digital_directions
Configures digital I/O channels as either inputs or outputs.
Description
The hil_set_digital_directions function configures digital I/O channels as either inputs or outputs. In general, a digital I/O line cannot be configured as an input and output at the same time.
Prototype
t_error hil_set_digital_directions(t_card card, const t_uint32 input_channels[], t_uint32 num_input_channels, const t_uint32 output_channels[], t_uint32 num_output_channels);
Parameters
t_card card
A handle to the board, as returned by hil_open.
const t_uint32 [] input_channels
An array containing the numbers of the digital I/O channels which will be configured as inputs.
Select a board type from the list for board-specific details: .
If no channels are to be configured as inputs then this parameter may be NULL
. In this case,
num_input_channels must be zero.
t_uint32 num_input_channels
The number of channels specified in the input_channels array. This parameter may be zero.
const t_uint32 [] output_channels
An array containing the numbers of the digital I/O channels which will be configured as outputs.
Select a board type from the list for board-specific details: .
If no channels are to be configured as outputs then this parameter may be NULL
. In this case,
num_output_channels must be zero.
t_uint32 num_output_channels
The number of channels specified in the output_channels array. This parameter may be zero.
Return value
The return value is 0 if the digital directions are set 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_DIGITAL_DIRECTIONS_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_DIGITAL_INPUT_CHANNELS
Too many digital input channels were specified.
QERR_INVALID_DIGITAL_INPUT_CHANNEL
One of the digital 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_DIGITAL_INPUTS
The array of input channels is NULL even though the number of inputs specified is non-zero.
QERR_TOO_MANY_DIGITAL_OUTPUT_CHANNELS
Too many digital output channels were specified.
QERR_INVALID_DIGITAL_OUTPUT_CHANNEL
One of the digital 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_DIGITAL_OUTPUTS
The array of output channels is NULL even though the number of outputs specified is non-zero.
Requirements
Include Files |
Libraries |
---|---|
hil.h |
hil.lib;quanser_runtime.lib;quanser_common.lib |
Examples
/*
* Set the directions for the first three digital channels. Channels 0 and 3 are configured as outputs
* while channel 1 is configured as an input.
*/
t_uint32 input_channels[] = { 1 };
t_uint32 output_channels[] = { 0, 3 };
t_error result = hil_set_digital_directions(board, input_channels, ARRAY_LENGTH(input_channels),
output_channels, ARRAY_LENGTH(output_channels));
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.