LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple tasks with daqmx

Solved!
Go to solution

Hello,

 

I am currently working on a Senior Design Project where I have to measure torque, RPM, pressure and temperature.  I am using strain gages, a Hall Effect Sensor, pressure sensor and thermocouples to obtain these readings.  A myDAQ collects the RPM and pressure readings while a cDAQ collects the torque and temperature readings with the NI 9237 and NI 9211 modules.  I created LabVIEW VIs for each sensor and they work.  The problem I am having is when I try create a VI with DAQmx that reads all these sensor values simultaneously.  The VI that I have attached randomly displays one of the measurements while all the other measurements remain blank.  How should I edit my VI so I can display all my readings at once?

0 Kudos
Message 1 of 10
(10,995 Views)

You can form all of your cDAQ readings into a single DAQmx task.  Do the same for the myDAQ channels.  On the read side, you just read multiple channels.  You can then use the Array Index to separate your channel data and do whatever calculations you need.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(10,991 Views)

Okay, I did exactly as you said and formed all my myDAQ and cDAQ readings into a single task.  I used index array to separate my channel data.  However, when I run it I still do not see any data displayed.  Did I forget something in my VI or can I only do one task at a time with the 30 day version of LabVIEW?  Thanks.

0 Kudos
Message 3 of 10
(10,966 Views)

Any errors on the error wire coming out of the DAQmx Read?

0 Kudos
Message 4 of 10
(10,954 Views)

No, I do not get any reported errors when I run my VI.  On the front panel time across the graphs runs, but there are no measurements displayed.  The numerical indicators on the front panel also show NaN.  When I ran another VI that just took one thermocouple measurement, I noticed the same thing happened if I forgot to select the module type in the DAQmx physical channel on the front panel.  However, for this VI I selected all the modules for my DAQmx physicals channels, yet I still have the same problem.  Is there a specific way I have to order the measurements in the VI?  For instance, do I have wire all the measurements taken by the cDAQ before my myDAQ measurements?  Or could it be that I need to change the sampling rate on the Sample clock?

0 Kudos
Message 5 of 10
(10,939 Views)

I will add a general error handler to my VI and reconnect my modules and see what errors I get.

0 Kudos
Message 6 of 10
(10,927 Views)

The error I got when I used the simple error handler was Error 200558.  So I read up on that error and it says one task cannot contain multiple independent devices.  Thus, I have to create a task for each independent device.  How am I supposed to set up another task?  Do I just link all my DAQmx Creates for the cDAQ to my DAQmx Read and then link all my myDAQ DAQmx Creates to another DAQmx Read and run them in parallel or is there another way to go about this?

0 Kudos
Message 7 of 10
(10,902 Views)
Solution
Accepted by topic author SSS1

Yes.  Create multiple tasks where all of the channels that are common for a particular device are grouped into the same task.  Then go and run those tasks in parallel.  Do you need precise synchronization between channels in the different devices?  If not, then the described method should work just fine.  If you need precise synchronization, then things would get more complicated, but might not be impossible.

Message 8 of 10
(10,897 Views)

Thanks for all the help.  It worked like a charm.  The synchronization looks good enough for my Senior Design project. Smiley Happy

0 Kudos
Message 9 of 10
(10,888 Views)

Oh yeah, this is how I set it up in order to get it to run.

0 Kudos
Message 10 of 10
(10,886 Views)