quanser.hardware.hil.read_other quanser.hardware.hil.write_analog navigation bar

Table of Contents

quanser.hardware.hil.read

Reads the specified channels.

Syntax

[analog_values, encoder_counts, digital_values, other_values, err]
    = board.read(analog_channels, encoder_channels, digital_channels, other_channels)
    

Description

Reads the specified analog, encoder, digital or other input channels immediately. Channel numbers are zero-based. Specify an empty matrix, [], to specify no channels.

If no err output is provided then it throws an exception if an error occurs. In generated code it prints the error message. Use hil_get_error_message to get the message associated with an error code.

Parameters

board

The board instance returned by the quanser.hardware.hil.open function.

analog_channels

A vector of analog channel numbers. Channel numbers are zero-based. This parameter may be an empty matrix, [].

Select a board type from the list for board-specific details: .

encoder_channels

A vector of encoder channel numbers. Channel numbers are zero-based. This parameter may be an empty matrix, [].

Select a board type from the list for board-specific details: .

digital_channels

A vector of digital channel numbers. Channel numbers are zero-based. This parameter may be an empty matrix, [].

Select a board type from the list for board-specific details: .

other_channels

A vector of other channel numbers. Channel numbers are zero-based. This parameter may be an empty matrix, [].

Select a board type from the list for board-specific details: .

Outputs

analog_values

A vector of analog voltages. There is one element for each analog channel selected. If no analog channels were specified then this parameter may be an empty matrix, [].

encoder_values

A vector of encoder counts. There is one element for each encoder channel selected. If no encoder channels were specified then this parameter may be an empty matrix, [].

digital_values

A vector of logical values. There is one element for each digital channel selected. If no digital channels were specified then this parameter may be an empty matrix, [].

other_values

A vector of values. There is one element for each other channel selected. If no other channels were specified then this parameter may be an empty matrix, [].

err

A negative error code or zero on success.

Examples

% Reads analog channel 0, encoder channel 4, digital channel 2 and other channel 1
[volt, cnt, bit, xtra] = board.read(0, 4, 2, 1);

% Reads analog channel 0 and digital channels 2 and 3
[voltage, bits]  = board.read(0, [], [2 3]);

% Reads analog channel 0 and encoder channel 4
[voltage, count] = board.read(0, 4);
    

See Also

 

navigation bar