User manual
Chapter 3 Software Overview
© National Instruments Corporation 3-75 NI-DAQ User Manual for PC Compatibles
Align_DMA_Buffer
.Tousethe
Align_DMA_Buffer
utility function,
follow these steps:
1. Allocate a buffer twice as large as the number of data samples you are
generating.
2. If you are using digital output, build your digital pattern in the buffer.
3. Call
DIG_Grp_Config
for port assignment.
4. Call
DIG_Block_PG_Config
to enable pattern generation.
5. Call
Align_DMA_Buffer
, as described in the NI-DAQ Function
Reference Online Help file.
6. Call
DIG_Block_In
or
DIG_Block_Out
with the aligned buffer to
initiate the process.
7. Call
DIG_Block_Clear
after the pattern generation completes.
8. Because
DIG_Block_Clear
unaligns the buffer, you can access the
digital input pattern generation as you can with an unaligned buffer.
To use the same buffer again for digital output pattern generation,
you must call
Align_DMA_Buffer
again.
Double-Buffered I/O
With the double-buffered (
DIG_DB
) digital I/O functions, you can input
or output unlimited digital data without requiring unlimited memory.
Double-buffered digital I/O is useful for applications such as streaming
data to disk and sending long data streams as output to external devices.
For an explanation of double-buffering, refer to Chapter 4, NI-DAQ
Double Buffering.
Digital double-buffered output operations have two options. The first
option is to stop the digital block operation if old data is ever encountered.
This occurs if the
DIG_DB_Transfer
function calls are not keeping pace
with the data input or output rate; that is, new data is not transferred to
or from the circular buffer quickly enough. For digital input, this option
prevents the loss of incoming data. For digital output, this option prevents
erroneous data from being transferred to an external device. If the group is
configured for handshaking, an old data stop is only a pause and a call to
one of the transfer functions resumes the digital operation. If the group is
configured for pattern generation, an old data stop forces you to clear and
restart the block operation.
The second option, available only to output groups, is the ability to transfer
data that is less than half the circular buffer size to the circular buffer. This
option is useful when long digital data streams are being output, but the size
of the data stream is not evenly divisible by the size of half of the circular