LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx - How long survives a task?

Solved!
Go to solution

Hi folks,

 

I would like to store the DAQmx Task in the private data cluster of a wrapper class, in order to be able to configure it with one method and to start it with another one.

 

The wrapper is needed, because I need some additional functionality. The task based approach is needed because I want to read really fast and timing might by a problem. I need to be able to poll with the maximum speed. I do not use the assistant, because the task should be set up programatically.

 

I do not find information about the data type, it seems to be a normal string. When does it die? Data value references for example die with the vi hierarchy that created it. I need to be sure, that the task stops only with the stop task VI. I can guarantee, that it is called before my program stops.

 

Unfortunately I am a new to LabView and this is my firtst approach to DAQmx. 

 

Thanks in advance

0 Kudos
Message 1 of 6
(3,718 Views)
Solution
Accepted by mthimm1

mthimm1 wrote:

I do not find information about the data type, it seems to be a normal string. When does it die? Data value references for example die with the vi hierarchy that created it. I need to be sure, that the task stops only with the stop task VI. I can guarantee, that it is called before my program stops.


The DAQmx Task is also a reference.  So it will go by the same rules as a DVR reference.


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
Message 2 of 6
(3,697 Views)

@crossrulz wrote:

mthimm1 wrote:

I do not find information about the data type, it seems to be a normal string. When does it die? Data value references for example die with the vi hierarchy that created it. I need to be sure, that the task stops only with the stop task VI. I can guarantee, that it is called before my program stops.


The DAQmx Task is also a reference.  So it will go by the same rules as a DVR reference.


It was to early in the morning this morning. If the DAQmx task is a DVR I wonder how it can be created by the create virtual channel VI. This exits before I start the play task VI. I experinced that LabView throws an error, when I try to access a garbage collected DVR.  This does not happen, I am getting the actual values from the VI.

 

 

0 Kudos
Message 3 of 6
(3,684 Views)

mthimm1 wrote:  If the DAQmx task is a DVR I wonder how it can be created by the create virtual channel VI. This exits before I start the play task VI. I experinced that LabView throws an error, when I try to access a garbage collected DVR.  This does not happen, I am getting the actual values from the VI.

The DAQmx task is NOT a DVR.  They are both references to something.  I think I need to see your code to better understand your problem here.


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 4 of 6
(3,667 Views)
Solution
Accepted by mthimm1

Actually DAQmx is a little more involved than many other refnum types in LabVIEW. These are so called named refnums like VISA is too. For VISA the name specifies the whole resource and the VISA subsystem will first attempt to use the underlaying refnum and when it considers it invalid (because it was never opened or the refnum was garbage collected) it will reopen the refnum.

 

DAQmx works similar except that there a task can be named (configured in MAX) or unnamed (created with the DAQmx VIs). For named tasks LabVIEW has all the necessary information to recreate the task when necessary so even if the refnum was garbage collected it will simply be recreated. That may still not always be enough if the task needs additional configuration such as for buffered timed acquisition or synchronization with other tasks. But for simple Read Value calls LabVIEW certainly will know enough from the MAX task configuration to recreate the task when necessary. Still, recreating a task takes time so it is generally better to create it once and make sure it stays alive during a specific test run.

Rolf Kalbermatter
My Blog
Message 5 of 6
(3,644 Views)

Forum.png

This ist the VI that creates the task. Since my LabView version is german, all texts are german, I am sorry for that.

 

There is another VI, which polls the data one time and a third one, which stops the task. The polling infrastructure is provided by some parent class that does not know anything about DAQmx.

 

I wanted to know if I can be sure, that the task is still valid although it is stored in the private data cluster and nor part of a running vi hierarchy. This is probably a silly question but a few days ago I have had heavy problems with data value references which were disapearing.

 

Thanks in advance!

0 Kudos
Message 6 of 6
(3,635 Views)