04-08-2008 09:22 AM
04-08-2008 03:12 PM - edited 04-08-2008 03:13 PM
@SWeng wrote:My application has four separate threads trying to make voltage measurements on 4 separate AI channels but while averaging in one channel (looping around the AI_Read() call) the others must wait while the current channel is finished. Any help is greatly appreciated.-Brian
04-08-2008 03:56 PM
04-09-2008 09:38 AM - edited 04-09-2008 09:38 AM
You need not create different threads for different channels. All channels can be under one single task (or your "thread"). You just have to specify multiple channels(formatting the channel string) in a single task. Refer to your LabVIEW/DAQmx Help for how to create channel string. Search for "Physical channel Syntax" in LV help.
SWeng wrote:
Yes, the 1st thread calls AI_VRead() on AI channel 3, the 2nd thread calls AI_VRead on AI channel 4, the 3rd thread calls AI_VRead on AI channel 5 and the 4th thread calls AI_VRead on AI channel 6.
Yes it IS possible to read a specified number of measurements using DAQmx read vi.
SWeng wrote:
The API doesn't allow you to supply the number of measurements to make and return the averaged reading. My application has to call AI_VRead() 20,000 times and perform the averaging.
SWeng wrote:
Also it appears that 4 AI channels cannot be read simultaneously. Or am I wrong.
04-09-2008 03:31 PM
Hi SWeng,
The AI_VRead() function is designed to read one channel when you call the function. In order to read multiple channels with hardware timing I would recommend looking at the example program SCANsingleBufSync.c. This file can be found under C:\Program Files\National Instruments\NI-DAQ\Examples\VisualC\Ai if you installed C support with your Traditional NI-DAQ drivers.If the example is not on your computer see the Knowledge Base article, How Do I Install Examples for Visual Basic, Visual C++, and Delphi with NI-DAQ? Also some help files for the examples can be found in the article, Where Do I Find Help for Visual Basic and C Examples in Traditional NI-DAQ?If you are developing a new program and do not have to use Traditional NI-DAQ I would strongly recommend using our newer NI-DAQmx drivers. They will work fine with your 6052e as long as it is in the PCI or PXI form factor. If you have a DAQPad-6052E then you have to use the Traditional NI-DAQ drivers.The DAQmx driver is more robust and easier to use. A great article for learning the basics of DAQmx is the Developer Zone, Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications. I would also recommend looking at the Getting Started with NI-DAQmx series of articles.Let me know if you have any questions and have a great week.Thanks,04-09-2008 06:55 PM - edited 04-09-2008 06:57 PM