Table of Contents > QUARC > User's Guide > QUARC External Interfaces > C Functions > Hardware > HIL API > Function Reference > Functions - By Category > Function Categories
Buffered I/O
Buffered I/O functions read or write multiple samples from or to the HIL hardware. The rate at which the samples are read from or written to the hardware is determined by the frequency parameter of the buffered I/O function. For example, consider the hil_read_analog_buffer function. Suppose the frequency parameter of the block is 1000 Hz and the num_samples parameter is 20. The hil_read_analog_buffer function will read a burst of 20 samples. Those samples will be collected at a sampling frequency of 1000 Hz. Thus, the function will take 20 milliseconds (plus any overhead) to execute.
There are three types of buffered operations: read, write, and read-write. The buffered read functions read the specified number of samples of all the input channels indicated at the given sampling rate. The buffered write functions write the specified number of samples to all the output channels indicated at the given sampling rate. The read-write buffered functions are a combination of the two operations. At each sampling instant, all the input channels indicated are read. Then all the output channels specified are written. Since the read and write occurs at the lowest level the two operations are virtually concurrent. This synchronization of the read and write operations is particularly useful for system identification. Refer to the analog_loopback example for a demonstration of this synchronization.
The hil_read_buffer function allows analog, encoder, digital and other channels to be read at the same time. Likewise the hil_write_buffer function allows analog, PWM, digital and other channels to be written at the same time. If more than one type of channels is being read (or written) then it is generally more efficient to use the hil_read_buffer function (or hil_write_buffer) function than to use separate function calls for each type of channel. Similarly, the hil_read_write_buffer function allows any combination of input and output channels set to be read and written simultaneously.
The buffered I/O functions are:
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.