Table of Contents
hil_read_encoder_buffer
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 number of samples from the encoder channels at the indicated sampling rate.
[counts, samples_read, err] = hil_read_encoder_buffer(board, clock, frequency, samples, channels)
Reads the specified number of samples from the encoder channels at the indicated sampling rate. The clock parameter indicates the clock to use as a timebase. This function outputs the counts read as a matrix, in which there is one row for each channel, and one column for each sample. The channels appear in the rows of the output matrix in the same order that they are specified in the channels parameter.
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.
clock
The clock to use as a timebase for the buffered operation. Hardware clocks are
numbered incrementally starting at 0, with 0 meaning HARDWARE_CLOCK_0
,
1 meaning HARDWARE_CLOCK_1
, etc. The number of clocks available depends
on the board selected. Refer to
Clocks for more information.
Select a board type from the list for board-specific details: .
frequency
The number of samples per second to collect from the specified channels. At each sampling instant, all indicated channels are read.
samples
The number of samples to collect from the specified channels. One sample consists of all the indicated channels.
channels
A vector of channel numbers. Channel numbers are zero-based.
Select a board type from the list for board-specific details: .
counts
A matrix of encoder counts, as int32s. There is one row for each channel and one column for each sample.
samples_read
The number of samples read. This value will equal the number of samples specified unless the operation was canceled.
err
A negative error code or zero on success.
% Reads 5000 samples of encoder channels 0 and 3 at 1 kHz using SYSTEM_CLOCK_1
counts = hil_read_encoder_buffer(board, -1, 1000, 5000, [0 3]);
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.