Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Example of DAQmx DMA

Solved!
Go to solution

Hi,

 

I am using a 6221 DAQ card which has 2 DMA channels.  I have never used DMA and can't seem to find much information about it or any examples.  If anyone can point me towards some examples that would be great.  I want to acquire Continuous samples at the maximum sample rate of the card (250kHz) for an indefinite period of time and then have access to them later for analysis and evaluation.

 

Thanks in advance,

Steve

 

0 Kudos
Message 1 of 7
(4,784 Views)

What are you trying to do that you need to directly access the DMA lines? I've never done this either, and I'm not sure if on a non FPGA system you can easily directly use these lines. Is there a reason you wanted to use the DMA lines instead of some other method? Could you describe your application? I may be wrong about not being able to use them directly, but I too have had trouble finding you good resources on the subject. Perhaps with more information I might find something new.

0 Kudos
Message 2 of 7
(4,760 Views)

A 250kHz rate is actually pretty slow and any of the shipping examples can be looked at. For writing to disk, I would recomend you use the built-in TDMS streaming ability.

 

I strongly doubt that you really need direct access to DMA. Let the driver handle that.

Message 3 of 7
(4,756 Views)

To clarify, NI-DAQmx automatically uses DMA when you configure a 6221 task to use sample clock timing. You're already using DMA if you started with an example program that has "finite" or "continuous" in the name.

 

There are many ways to acquire samples for an indefinite period of time and then have access to them later, depending on the rest of your requirements. Which data do you need to save: all of it, or only some of it? If you only need some of the data, what criteria should be used to determine which data to save?

 

Brad

---
Brad Keryan
NI R&D
Message 4 of 7
(4,751 Views)

Kevin, Dennis and Brad,

 

Thanks for you replies.

I want to continuously acquire data from 2 of the analog inputs at 250kHz for an indefinite period of time (although likely under 10 seconds) and have access to all of the data afterwards for analysis.  If I sample for 10 seconds that will be 2.5 million data points on each channel or a total of 5 milliion points, so I may have to sample a little bit slower (maybe 20kHz to 50kHz).  My DAQ card only has 4095 data point onboard memory so I'm trying to figure out the best way to save all of the data and not miss any.  I saw that the card has 2 channels of DMA and thought that I could use that, unless another option is available.

 

Steve

 

0 Kudos
Message 5 of 7
(4,737 Views)
Solution
Accepted by Steve_G

Hey Steve,

 

The 6221 is multiplexed, so the 250 kHz spec is the aggregate rate that you can sample on all channels.  If you are sampling 2 channels at the same time, the max rate would be 125 kHz.

 

DAQmx will transfer data from the on-board memory to a pre-allocated buffer on your host PC while the acquisition is taking place.  By default DAQmx uses DMA as the transfer mechanism for PCI-based M Series cards like your 6221, but you don't really need to worry about configuring this (if you really wanted to you have the option to change your transfer mechanism to Interrupts but I wouldn't recommend doing so).  There are actually 6 DMA channels on the 6221 (one for every buffered subsystem)--this is documented in the specifications page. If you have a link that says otherwise please share so NI can correct the misinformation.

 

In summary, I wouldn't worry too much about the exact mechanism that is being used to transfer data to your host PC, the driver takes care of this for you.  The way I interpret your post, it sounds like you want to log the data to disk and perform analysis on it at a later time.  If you do want to log to disk, I suggest using the integrated TDMS logging feature like Dennis mentioned earlier.  Here's an example:

 

Continuously Read Data and Log to a TDMS File

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 7
(4,731 Views)

John,

 

This is perfect.  Thank you for all of the information.

 

Steve

0 Kudos
Message 7 of 7
(4,708 Views)