quanser.hardware.hil.read_digital_write_digital_buffer quanser.hardware.hil.read_write_buffer navigation bar

Table of Contents

quanser.hardware.hil.read_other_write_other_buffer

Reads from the specified other input channels and writes to the other output channels at the given sampling rate, for the indicated number of samples.

Syntax

[input_values, n, err] = board.read_other_write_other_buffer(clock, frequency, samples, ...
    input_channels, output_channels, output_values)
    

Description

Reads from the specified other input channels and writes to the other output channels at the given sampling rate, for the indicated number of samples. Channel numbers are zero-based. The write operation is performed immediately after the read operation (generally performed at the hardware or device driver level so the operations are virtually concurrent). This function is particularly useful for system identification because the reads and writes are synchronized. The first sample read is the initial condition. The next sample read is the response to the previous sample written. Likewise for subsequent samples.

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.

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 sampling frequency in Hertz at which samples will be collected.

samples

The number of samples to collect and generate.

input_channels

A vector of input channel numbers.

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

output_channels

A vector of output channel numbers.

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

output_values

A matrix of other values. There must be one row for each channel and one column for each sample.

Outputs

input_values

A matrix of other values, as doubles. There is one row for each channel. All output matrices must have the same number of columns.

samples_read

The number of samples collected. This number will always equal the number of specified samples unless the operation was canceled.

err

A negative error code or zero on success.

Examples

        % Uniformly distributed random values between -5V and +5V.
        volts = 5*(rand(2, 5000)-0.5)*2;

        % Writes the 5000 samples of the 'volts' data to other channel 5 while reading from other channels 0 and 3 at 1 kHz.
        v = board.read_other_write_other_buffer(-1, 1000, 5000, [0 3], 5, volts);
    

See Also

 

navigation bar