Chapter 4
Programming
4-20
©
National Instruments Corporation
13. The function
AI_Start_The_Acquisition
starts the acquisition
process.
AI_Command_2_Register
AI START1 Pulse = 1;
14. Call the function
MITE_DMAarm
to start the DMA transfer.
15. Loop to check the status about how many bytes still remain in process.
This loop stops when the number of transfers remaining exceeds the
number of buffers. When DMA finishes transferring data to each
buffer, transfers remaining becomes 0. Thus, there are at least n
transfers remaining for n buffer transfers.
do {
Call the
MITE_DMAgettransfersRemaining
to check the
number of bytes remaining
if (transfersRemaining==0) increase transfersendcount;
} while (transfersendount<=NumberOfBuffer);
16. Print out the data in the buffers
17. Call the function
MITE_DMAdisarm
to disarm the MITE for DMA.
18. Release the memory storage used by the buffer information linked list.
Programming the MITE for Different DMA Transfers
To use DMA transfer for Analog Output, store the output data in the buffers
and construct the output buffer information linked list. Then, perform all
the steps above but pass OUTPUT for the direction parameter to the
function
MITE_DMAProgram
.
To perform two or more DMA transfers at the same time, use different
DMA and DRQ channels for different DMA transfers. For example, you
want to have DMA transfers for analog input and analog output at the same
time. Use DRQ channel 0 and DMA channel 0 for analog input, and DRQ
channel 1 and DMA channel 1 for analog output. In other words, use only
one DMA channel and one DRQ channel to perform either analog input or
analog output. When using two or more channels for DMA transfers, call
the functions
MITE_DMAProgram
,
MITE_DMAarm
two or more times. To
operate analog input and analog output at the same time, call the function
MITE_DMAProgram
and pass the input buffer information linked list head
node pointer, number of buffers, 0 for drqnum, INPUT for direction,
FALSE for continuous and 0 for dmachannel. Call the function
MITE_DMAProgram
again and pass the output buffer information linked
list head node pointer, number of buffer, 1 for drqnum, OUTPUT for
direction, FALSE for continuous and 1 for dmachannel. Then call
MITE_DMAarm
twice for DMA channel 0 and channel 1. After the DMA