From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple taskhandles read problems

Solved!
Go to solution

Dear all,

 

I sat all day here trying to figure out what is wrong with my Labwindows data acquisition systems. To be specific, I created multiple channel data acqusition (7 signals from 6 different instruments) using LabWindows 2013 on a Win7 OS. Five signals are taking at the same time, and another two needs to be done separately. To realize, I created two DAQmxCreateAIVoltage tasks. However, when running, it turns out the task created second did not give any data other than zeros. I switched the creating sequence of the two tasks. It turns out the task created second always do not give any signal. 

 

My question is, it is allowed to create two data acquistion taskhandles at the same time in one single application? If not, is there a way to circumvent it?

 

Thank you for your suggestions in advance.

0 Kudos
Message 1 of 5
(4,451 Views)

While it is possible to have multiple AI tasks concurrentry running, there may be problems due to hardware limited resources: this is usually noted as an error while creating or adding channels to the tasks.  Are you trapping daqmx errors? Do reading functions return any?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 5
(4,438 Views)

Hello Robert,

 

The DAQ board I am using is kind of old PCI-6052E. I created two AI tasks at the same time and let them run concurrently. It seems to me that the first task created gives right signal, while the second one gives plain 0, no actual DC signal was captured. I tried to switch the sequence of creating the tasks in the code. This time, no signal was captured for the first five channels, good for last two. Do you think this is actually due to the hardware limits? Are there any limits for the number of channels to be put in one taskhandle? 

0 Kudos
Message 3 of 5
(4,434 Views)
Solution
Accepted by topic author chan07013

You are limited in how many tasks can run concurrently depending on hardware resources avaialble. You may not be able to run two AI tasks on the same board for example because the board does not have enough timing hardware to handle them. This situation should cause errors in daqmx functions so I'm asking again: are you trapping daqmx errors? Do you receive any error? Check that Run >> Break On >> Library errors menu item is selected and run your program: in case of errors it should break on the offending line.

A workaround for this is normnally to acquire all channels in a single task and extract some samples only for the channels you want to acquire at a slower rate. Decimate function can be used for that.

 

See this page for reference.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 5
(4,421 Views)

Thank you, Robert!

 

I guess I am trapping the errors, since no error check function, which normally is included in tutorial program, is used in my program. So, I did not receive any errors related to the DAQmx function. I followed the workaround you suggested to create only one taskhandle to capture the inputs. It worked, giving reasonable data.

0 Kudos
Message 5 of 5
(4,405 Views)