Linux Users

cancel
Showing results for 
Search instead for 
Did you mean: 

Having problems storing DAQmx tasks in a class cluster

I have a PXI-6528 DIO card.  I would like to open a task for every Digital Output channel as well as a task for a whole port and all ports.  I store a string for each task and a task out reference for each task in an array of clusters and store this in my class cluster.  But when I put a probe on the array, I don't see the task names.  I don't name the tasks, I let them default to _unamedTasks and I can see them being created by putting a probe on the task out wire. But when I probe the array, the task names are blank.  Can you store task references in arrays?  Can you store them in shift registers and class clusters?

Here is a snipit that might explain what I am trying to do a little better:

Init_tasks.png

Thanks.

0 Kudos
Message 1 of 4
(7,797 Views)

LabVIEW handles un-named tasks differently than named tasks. Refnums associated with named tasks are retained in LabVIEW memory and reused if another refnum is requested for the same name. However un-named tasks are completely removed from LabVIEW memory when their refnum is released (which in DAQ's case happens when Clear Task is called or the VI hiearchy goes idle). If a NI-DAQmx indicator's (or probe) value is updated before the unnamed task refnum is released, the name is retrievable and thus could be displayed in the indicator, however, if it is updated after the refnum is released, the name associated with the refnum is no longer available and thus the indicator (or probe) can not updated.

For LabVIEW 2010 it was decided to make the behavior more consistent by never showing the name of tasks that weren't explicitly named.  Afterall they are "unamed" tasks.  Even though the task name is blank in your case, the refnum still holds a reference to the task (albeit it is not stored as a string name).  If you give the tasks explicit names I would expect the task name to not be blank in the probe.  You can give the task an explict name by calling DAQmx Create Task.vi.  If you want to continue to use unnamed tasks but would like to store the name to the task you can retrieve the name to the unamed task by using a Task property node.  You can also typecast the task refnum to a string which will force returning the name that DAQmx chose for the task to be returned.

0 Kudos
Message 2 of 4
(3,740 Views)

Thanks for the info. The VI going idle was causing the problem.

Another question. So in my snippet, I am actually just creating virtual channels, not really a task.  Does this make a difference?  I setup several virtual channels that share the same physical channel, then use these unamed tasks to read and write to the channel. 

Thanks.

0 Kudos
Message 3 of 4
(3,740 Views)

When you create a virtual channel a task is implicitly created.  Since the task wasn't explicitly named (since it was implicitly created) the same behavior will occur.

0 Kudos
Message 4 of 4
(3,740 Views)