User`s guide
66
•
Continuous Data Transfer in PCIS-DASK
The PCIS-DASK double buffer mode functions were designed according to the
principle described above. If you use
AI_AsyncDblBufferMode/DI_AsyncDblBufferMode to enable double
buffer mode, the following continuous AI/DI function will perform double-
buffered continuous AI/DI. You can call
AI_AsyncDblBufferHalfReady/DI_AsyncDblBufferHalfReady to
check if data in the circular buffer is half full and ready for copying to the
transfer buffer. Then you can call
AI_AsyncDblBufferTransfer/DI_AsyncDblBufferTransfer to copy
data from the ready half buffer to the transfer buffer.
6.2.2 Single-Buffered Versus Double-Buffered Data Transfer
Single-buffered data transfer is the most common method for continuous data
transfer. In single-buffered input operations, a fixed number of samples are
acquired at a specified rate and transferred into user’s buffer. After the user’s
buffer stores the data, the application can analyze, display, or store the data to
the hard disk for later processing. Single-buffered operations are relatively
simple to implement and can usually take advantage of the full hardware
speed of the device. However, the major disadvantage of single-buffered
operation is that the maximum amount of data that can be input at any one
time is limited to the amount of initially allocated memory allocated in driver
and the amount of free memory available in the computer.
In double-buffered operations, as mentioned above, the data buffer is
configured as a circular buffer. Therefore, unlike single-buffered operations,
double-buffered operations reuse the same buffer and are able to input or
output an infinite number of data points without requiring an infinite amount of
memory. However, there exits the undesired result of data overwritten for
double-buffered data transfer. The device might overwrite data before PCIS-
DASK has copied it to the transfer buffer. Another data overwritten problem
occurs when an input device overwrites data that PCIS-DASK is
simultaneously copying to the transfer buffer. Therefore, the data must be
processed by the application at least as fast as the rate at which the device is
reading data. For most of the applications, this requirement depends on the
speed and efficiency of the computer system and programming language.
Hence, double buffering might not be practical for high-speed input
applications.