Table of Contents
hil_read
The HIL API MATLAB functions have been deprecated in favour of the new quanser.hardware.hil class, which has support for code generation for Quanser targets. Hence, with the new hil class it is possible to run MATLAB scripts in real-time on Quanser targets, while making use of the Quanser hardware. |
Reads the specified channels.
[analog_values, encoder_counts, digital_values, other_values, err] = hil_read(board, analog_channels, encoder_channels, digital_channels, other_channels)
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.
board
The board handle returned by hil_open.
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: .
analog_values
A vector of analog voltages, as doubles. 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, as int32s. 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 digital values, as int8s. 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, as doubles. 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.
% Reads analog channel 0, encoder channel 4, digital channel 2 and other channel 1 [volt, cnt, bit, xtra] = hil_read(board, 0, 4, 2, 1); % Reads analog channel 0 and digital channels 2 and 3 [voltage, bits] = hil_read(board, 0, [], [2 3]); % Reads analog channel 0 and encoder channel 4 [voltage, count] = hil_read(board, 0, 4);
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.