10-29-2024 03:11 AM
Hi everyone,
I’m facing this strange behaviour of my Vis called in a TestStand Sequence. In order to activate and stop the Audio and the Digital IO when I need, I have created these VI which exchange the task during a Teststand sequence. Which it looks like this:
I can’t understand why sometimes these Vis throw different errors on the Tasks passed as it is wrong or missing but I don’t get why. I’m using a USB-6211 device.
Is there something that I’m missing or I’m doing wrong? I don’t know what else to do for facing the problem.
Best Regards,
Zuc
10-29-2024 10:33 AM
Tasks, like any other reference in LabVIEW, are destroyed when the VI that created them is closed. One way to deal with this, that I'm aware of, is to create a continuously running VI to create the task then close that VI when no longer needed.
10-29-2024 11:03 AM
A better way is to have a session manager that continuous runs to keep the task alive and other VIs can query from this session manager and use the session, this way the DAQmx tasks exchange is totally on LabVIEW layer and not passed through TestStand
10-30-2024 02:38 AM
Probably I have forgotten to mention that, as you can see from the VIs, the Task is an output. So, the VI generates the task which is saved inside a TS FileGlobals variable which is then passed as an input for the VI which is in charge of closing that task. Is this way of programming wrong?
Best Regards,
Zuc
10-30-2024 02:40 AM
Hi,
Thank you for the advice but what is a session manager and how or where I can find more information about it? I have never heard of a session manager but for what? For being continuously connected with the USB-6211 device?
Best Regards,
Zuc
10-30-2024 09:10 AM - edited 10-30-2024 09:12 AM
@santo_13 wrote:
A better way is to have a session manager that continuous runs to keep the task alive and other VIs can query from this session manager and use the session, this way the DAQmx tasks exchange is totally on LabVIEW layer and not passed through TestStand
Not quite! 😉
The absolute simplest way is to:
I've said it before (and it is worth repeating) DAQmx Tasks, Scales etc... need only be created ONCE! Preferably, during development and almost never need to be created at runtime!!!!
A TestStand Step that Creates a Task is just poor practice.
10-30-2024 10:16 AM
You can also use state machine kind of design. Merge all VIs into one, and use shift register for the DAQmx Task.
No need to pass the task to/from TestStand.
10-30-2024 10:59 AM
Hi,
can you make an example of that? How can i shift task between generation on digital or analogical channel?
Best Regards,
Zuc
10-30-2024 11:40 AM
Drop the attached png file to a diagram to create VI.
10-30-2024 12:25 PM
@zou wrote:
Drop the attached png file to a diagram to create VI.
That USR can get stale if TestStand Step or Sequence load options are set to unload. But, a Task persisted to a lvproj (or NI MAX) is always defined and usable with even lower latency than programmatically created Tasks (it streamlines the validation of the Task)
Or, "Just do what I said."