NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Tasks in TestStand

I have a problem using two tasks for the NI9401 Digital Input/Output Module.

First I create a Task for line0 as an input and store the reference in a FileGlobal LabVIEWIOControl. I use the "DAQmx Create Task" and "DAQmx Create Virtual Channel" in a VI to do so. I then pass the FileGlobal as the 'task/channels' parameter to a VI with "DAQmx Read" and it works fine.

I then created a new Task for line7 as an output. I store the reference in a different FileGlobal LavVIEWIOControl. I then pass that FileGlobal to "DAQmx Write" and it also works fine.

The problem occurs when I go back to the "DAQmx Read" vi. Even though I pass the read Task FileGlobal to it, when I look at the VI the name of the write Task appears in the Control. This baffles me since I'm sure I'm passing the correct Global.

When looking at the Global contents, I did notice that both Tasks have the same session ID. Is this the problem?

LabVIEW 7.1
TestStand 3.1
DAQmx 8.3.0f0

David
0 Kudos
Message 1 of 3
(3,826 Views)
If they both have the same session ID, that tells me that they are both pointing to the same task. First off, I would suggest not using Global Variables, especially with Data Acquisition tasks. This causes many different race conditions that we always advise against. Also, I tried reproducing this bug using the Read Dig Chan.vi and Gen Dig Pulse.vi examples and was unable to reproduce it. Have you tried running the VIs in LabVIEW by themselves (ie create a top-level VI that calls to your sub-vis in sequence)? If not, try this and let me know what the results are.

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
Message 2 of 3
(3,809 Views)
It looks to be working now. Before I configured a task, I would always clear the task first, in the event I was reconfiguring the task. Since it did not generate an error if the Task was not previously created, I didn't think it was a problem.

I changed my sequence to only clear the task if it previously existed. Now the SessionNumbers are always different for any tasks I create.

Thanks,
Dave

PS thanks for the tip of writing a top level VI. I did this to satisfy myself the problem was with the sequence and not the VIs. It helped me find the problem.
0 Kudos
Message 3 of 3
(3,796 Views)