User manual

Chapter 4 NI-DAQ Double Buffering
© National Instruments Corporation 4-11 NI-DAQ User Manual for PC Compatibles
The
DB_Transfer
functions for
DAQ
,
WFM
,
DIG,
and
GPCTR
are
synchronous for both input and output operations. In other words, when
your application calls these functions, NI-DAQ does not return control to
your application until the transfer is complete. As a result, your application
might crash if NI-DAQ cannot complete the transfer. To avoid this situation,
call the
Timeout_Config
function for
DAQ
,
WFM
,
DIG,
and
GPCTR
prior to
starting a double-buffered operation. The timeout configuration function
sets the maximum time allocated to complete a synchronous function call
for a device. For counter operations, the transfer function takes timeout as
one of the parameters, so you do need to call
Timeout_Config
prior to
calling the transfer function.
The transfer functions are as follows:
DAQ_DB_Transfer
WFM_DB_Transfer
DIG_DB_Transfer
GPCTR_Read_Buffer
For analog input operations, call
DAQ_DB_Transfer
after starting a
double-buffered analog acquisition to perform a double-buffered transfer.
For waveform operations, call
WFM_DB_Transfer
after starting a
double-buffered waveform generation to perform a double-buffered
transfer.
For digital block input and output operations, call
DIG_DB_Transfer
after
starting a double-buffered digital operation to perform a double-buffered
transfer.
For counter operations call
GPCTR_Read_Buffer
after starting the
operation to transfer a specified portion of the double buffer.
Double Buffer HalfReady Functions
With the Double Buffer HalfReady functions, applications can avoid the
delay possible when calling the double buffer transfer function. When you
call either of the transfer functions, NI-DAQ waits until the transfer to or
from the circular buffer can be made; that is, the DAQ device is operating
on the opposite half of the circular buffer.
The Double Buffer HalfReady functions check if a double buffer transfer
can be completed immediately. If the call to Double Buffer HalfReady
indicates a transfer cannot be made, your application can do other work
and try again later.