Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

How to sample analog device at high rate with USB-6218?

This is a total newbie question, but I am interested in sampling a pressure sensor at very high rates.  I know how to create sampling programs using while loops, with and without the DAQ Assistant.  But whenever I use these schemes, the representative sample rate is much lower, presumably due to Windows.  I know there is a way to write code so that data is sampled and buffered in such that no data is lost (within the limits of the ADC within my USB-6218 device), but I do not know where to get started.  Could someone please point me in the right direction?
Thanks and happy holidays! 
0 Kudos
Message 1 of 3

Hi NickyNews,

A great way to get started with LabVIEW programming is to look at the example programs and then modify these to fit your needs. Since you are interested in samples being read from your USB-6218’s on-board memory, I would suggest looking at the Continuous Voltage Acquisition Examples. Each of these examples has some form of the polymorphic read VI that can be seen in the attached screenshot from LabVIEW Help. If you have an idea of how fast you are acquiring samples, you can then set the number of samples that LabVIEW reads from the buffer with each iteration of the while loop around the read function.

These examples can be found by navigating to the Help Menu>> Find Examples>> expanding the Hardware Input and Output folder>>expanding the DAQmx folder>> expanding the Analog Measurements Folder>> and then looking in the Voltage file. When you click on an example VI, a brief description will appear in the Information box to the right of the Example Finder.

A useful way to ensure that any example program you select is supported by your NI device is to Limit the results to Hardware. This option can be found in the lower left side of the Example Finder. In the Hardware drop down menu, you can select "Add Device…" and then highlight your hardware. This will cause yellow arrows to appear in the center column to the left of all the examples that support your hardware. If you check the box next to “Limit results to hardware” under the drop down menu, the Example Finder will take a second to reset and show you only examples that support your hardware.

You had mentioned that you are concerned about data being lost. Any time this occurs when using DAQmx in LabVIEW, an overflow or overwrite error will be returned. If you experience one of these errors, the Knowledge Base ID 4D3AI5Q7: Understanding and Avoiding Overwrite and Overflow Errors with NI-DAQmx has a good explanation of what is occurring and steps to avoid this.

I hope this helps. Good Luck, Mallori M.

Message Edited by mallorim on 12-13-2007 08:25 AM
Mallori M
National Instruments
Sr Group Manager, Education Services
0 Kudos
Message 2 of 3

Thank you very much!



0 Kudos
Message 3 of 3