Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6009: Best way to sample multiple AI channels simultaneously

What would be the best way to sample multible AI channels at the same time or as close to the same time as possible. The method I was using was to have a single timer(1ms interval) that would start a new task aquire a single sample and then the task was disposed and then I had it check the next channel by starting a new task again. This method seemed to be kind of slow and was just wondering how the experts would approach the same problem.
0 Kudos
Message 1 of 5
(4,915 Views)
actually it does seem fast enough. Still curious if thats what you all would do though.
0 Kudos
Message 2 of 5
(4,914 Views)

Hi Mitch,

The USB-6009 is a Multiplexed device, what this means in your application is that you will not be able to have simultaneous sampling, The best way to sample each channel close to simultaneous is to put each channel in the same task, This will sample each channel when the each time the task is called. You will not have to wait for the program to complete and destroy the task each time you want to change channels. This can be accomplished by clicking the add channels button in the task configuration window in Measurement and Automation Explorer. Another option is to create the task and add channels in LabVIEW, below is a link to an example program doing just that.

Multiple Input Configurations in a Single Task

http://sine.ni.com/devzone/cda/epd/p/id/4524

Thank you,

JaceD
Applications Engineer
National Instruments

JaceD
Signal Sources Product Support Engineer
National Instruments
0 Kudos
Message 3 of 5
(4,898 Views)
Thanks I know the USB-6009 isn't the most ideal solution for what I'm asking, and that's why I'm building a peak-and-hold circuit so that I won't miss any signals going into the analog in.

Is there a way to have it sample more than one Analog In channel in Visual BAsic using the same task. OR were you using task in refernce to the cool Measurement and Automation Explorer.
0 Kudos
Message 4 of 5
(4,887 Views)

Hi Mitch,

There are two ways in which you can create and use tasks when programming with the NI-DAQmx API.  With the first method you can create and save the task within the Measurement and Automation Explorer and then call that saved task from your application.  The second method allows you to programmatically create and configure the task on the fly.  If you plan on distributing this application to other machines I would recommend the second method because then you will not be depending on the same task configuration to be saved in MAX on the target machine.

The .net help files explain this in great detail these can be found by going to Start>>all programs>>National Instruments>>NI-DAQ>>NI-DAQ .Net Framework help. Once in the help file the picture below should help you navigate.

I also found an example and was able to successfully run it on my machine that performs exactly what you are trying to accomplish. The file path should be as follows


C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET2.0\Analog In\Measure Voltage\AcqMultVoltageSamples_SWTimed\vb

When you run the example when selecting the channels to use, if you insert a colon then the end of your channel list (i.e. Dev1/ai0:7) you will read all 8 channels from 0-7.

Thanks

JaceD

Message Edited by jaced on 09-27-2007 03:36 PM

Message Edited by jaced on 09-27-2007 03:37 PM

JaceD
Signal Sources Product Support Engineer
National Instruments
0 Kudos
Message 5 of 5
(4,883 Views)