User manual
Chapter 3 Software Overview
NI-DAQ User Manual for PC Compatibles 3-74 ni.com
Pattern Generation I/O with the DIO-32F, 653X, PCI-6115,
and PCI-6120 Devices
Use pattern generation for clocked digital I/O when you have a group
that is written to or read from based on the output of a counter. The
DIG_Block_PG_Config
function enables the pattern generation
mode of digital I/O. When pattern generation is enabled, a subsequent
DIG_Block_In
or
DIG_Block_Out
call automatically uses this mode.
Each group for the DIO-32F and 653X devices has its own onboard counter
so that each can simultaneously run in this mode at different rates. Use an
external counter by connecting its output to the appropriate REQ pin at the
I/O connector. For an input group, pattern generation is analogous to a
data acquisition operation, but instead of reading analog input channels,
NI-DAQ reads the digital ports. For an output group, pattern generation is
analogous to waveform generation, but instead of writing voltages to the
analog output channels, NI-DAQ writes digital patterns to the digital ports.
The DIO-32F, 653X, PCI-6115, and PCI-6120 use DMA to service pattern
generation. However, certain buffers require NI-DAQ to reprogram
the DMA controller during the pattern generation. The extra time needed
to reprogram increases the minimum request interval (thus decreasing the
maximum rate unless you use dual DMA). Refer to Chapter 4, NI-DAQ
Double Buffering, for more information.
Note
For the AT-DIO-32F,
DIG_Block_In
and
DIG_Block_Out
return a warning if it is
necessary to reprogram the DMA controller. Also, page boundaries in a buffer that is to be
used for 32-bit digital pattern generation cause unpredictable results for AT bus computer
users, regardless of the request interval used.
For the DIO-32F, another option is to use the utility function
Align_DMA_Buffer
to avoid the negative effects of page boundaries in
the following cases:
• When using digital I/O pattern generation at small request intervals
for buffers with page boundaries
• When using 32-bit digital I/O pattern generation at any speed
To use
Align_DMA_Buffer
, however, you must allocate a buffer that is
larger than the sample count to make room for
Align_DMA_Buffer
to
move the data around. When the buffer is aligned, make the normal calls
to
DIG_Block_In
and
DIG_Block_Out
. A call to
DIG_Block_Clear
(either directly or indirectly through
DIG_Block_Check
) unaligns the
data buffer if the data buffer was previously aligned by a call to










