LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel Loops using DaqMX

I am trying to program 2 parallel loops using DaqMX VI's.  Outside of each loop is a Create Virtual Channel VI and a Start VI.   When I try to run the program, only one loop will run and I get  an error message indicating a conflict of resources.   The hardware I am using is the new Compact DAQ with the USB interface.  There are 2 modules:  a Thermocouple module, and an Analog Input module.   I am using LV ver. 7.0.   Is there an issue with creating 2 different Task IDs for the same device?   Any suggestion on resolving the problem would be apprreciated.

0 Kudos
Message 1 of 13
(5,647 Views)
You cannot have more than one task running on the same device. All you need to do is have a single task with multiple channels. In your case, use two different Create Virtual Channel functions. One for the thermocouple and one for the analog input. Wire the task out from one to the task in of the other and wire the task out of the second to the Start Task.
0 Kudos
Message 2 of 13
(5,641 Views)
I've already tried that option.    I guess I failed to mention that I want to acquire the analog signals at a faster rate.   Thermocouple are inherently slow, and the fastest loop time I can get is 350msec.    I would like to be able to run the analog loop at 100 msec.
0 Kudos
Message 3 of 13
(5,636 Views)
I don't see where you would have any other option than to have a second DAQ device or get a different one. The majority of DAQ boards from NI use a single A/D with a single convert clock and you can't specify two different acquisition rates or have more than one task running on the same hardware. Some of the USB devices have simultaneous sampling and if you have one of those or upgrade to one, then you can make things work the way you want. What model do you have now?
0 Kudos
Message 4 of 13
(5,633 Views)

The hardware I am using is as follows:

cDAQ-9172  (Chasis)

NI 9211  (TC Module)

NI 9205  (Analog Input Module)

0 Kudos
Message 5 of 13
(5,628 Views)
Hi,
 
CompactDAQ has a feature that will handle the 9211 in this particular application.  Unlike other AI modules, you can set your 9211 to run at a sample rate faster that what it can actually do.  For example, you can make a task that includes both a 9205 and a 9211 and set the sampling rate to be 100 kS/s.  The 9205 will sample at the specified 100 kS/s. However, since the 9211 cannot sample that fast, it will simply repeat the same data until a new sample as taken.  So the 9211 will actually be sampling at 14 S/s and return the same data point multiple times.
 
Thanks,
Sal
0 Kudos
Message 6 of 13
(5,619 Views)
Where do I set the sampling rate?
0 Kudos
Message 7 of 13
(5,612 Views)

Hi Roese,

You would set the sampling rate for the task just like any other, with the DAQmx Timing VI.  Using CompactDAQ, you can run multiple analog input modules in the same analog input task.  Being in the same task, all of the analog input modules would have the same sampling rate.  The sampling rate you specify is limited by the slowest module in the cDAQ chassis with the exception of the 9211.  The 9211 can be sampled faster than its max rate (you'll just get the same data multiple times).

-Sal

0 Kudos
Message 8 of 13
(5,601 Views)

 


@Dennis Knutson wrote:
You cannot have more than one task running on the same device. All you need to do is have a single task with multiple channels. In your case, use two different Create Virtual Channel functions. One for the thermocouple and one for the analog input. Wire the task out from one to the task in of the other and wire the task out of the second to the Start Task.

 

I'm a little bit confused by this, since I have successfully run two tasks from one device in parallel loops.  For example, the attached code runs fine.  Maybe it has to do with the fact that I am reading and writing on demand?

 

Ken

0 Kudos
Message 9 of 13
(5,003 Views)

@halvorka wrote:

 


@Dennis Knutson wrote:
You cannot have more than one task running on the same device. All you need to do is have a single task with multiple channels. In your case, use two different Create Virtual Channel functions. One for the thermocouple and one for the analog input. Wire the task out from one to the task in of the other and wire the task out of the second to the Start Task.

 

I'm a little bit confused by this, since I have successfully run two tasks from one device in parallel loops.  For example, the attached code runs fine.  Maybe it has to do with the fact that I am reading and writing on demand?

 

Ken


One of the rare instances where Dennis gave an errant answer.  I too have run two separate tasks on one Multifunction DAQmx device, just as shown by halvorka.  I have also done the same with HSDIO devices, one task to generate data and another task to read data, all running in parallel.  Maybe only certain devices can do this and others can't.

 

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 13
(4,983 Views)