01-18-2023 12:55 PM
Problem: I'm trying to use Express VI's with DAQmx blocks so that I can change the device that the DAQmx block uses, but DAQmx blocks return errors when connected this way
Why: we have multiple identical testing units, with their own NI hardware, and would like our software to work automatically with any of them. We also use a variety of laptops, so it would be preferable for the task information to be self-contained in the Labview software (so that we don't need to add/create the tasks anytime a new laptop wants to use a new testing unit)
In the help window to the Express VI's, "Task out" can be connected to DAQmx blocks (the relevant section included at the bottom of this post for convenience).
However, when I try to do this, the DAQmx blocks give a "invalid task" error. I've made a simplified VI to show this, attached to this post. I've also attached a screenshot after running, with relevant probes showing the error. To my understanding, The "task out" of the Express VI is blank, and is not passing the task it creates to the DAQmx blocks.
How can I fix this?
or, alternatively, Is there a better way to accommodate automatically switching devices, without needing to manage tasks in NI MAX and/or not needing discrete tasks for each set of NI hardware?
Parameter | Description |
---|---|
data | Contains samples read from the task. data is an output for measurement tasks and an input for analog and digital output tasks. data does not appear for counter output tasks. |
error out | Contains error information. If error in indicates that an error occurred before this Express VI ran, error out contains the same error information. Otherwise, it describes the error status that this Express VI produces. |
stopped | Indicates whether the task stopped. The task stops if the stop input is set to TRUE or an error occurs. This output appears for continuous or hardware-timed single-point tasks only. |
task out | Contains a reference to the task after this VI completes execution. Wire this output to other NI-DAQmx VIs to perform other operations with this task. |
Solved! Go to Solution.
01-18-2023 01:33 PM
Hi Tuck,
@tuckjohn wrote:
Problem: I'm trying to use Express VI's with DAQmx blocks so that I can change the device that the DAQmx block uses, but DAQmx blocks return errors when connected this way
Why: we have multiple identical testing units, with their own NI hardware, and would like our software to work automatically with any of them. We also use a variety of laptops, so it would be preferable for the task information to be self-contained in the Labview software (so that we don't need to add/create the tasks anytime a new laptop wants to use a new testing unit)
Problems:
Solution:
Stick with plain DAQmx functions. Read this and skip the ExpressVI paragraph!
01-18-2023 01:36 PM
Oop! Turns out if you fail the CAPTCHA it removes your attached files. They're attached here.
I'll check out that link.
01-18-2023 01:54 PM
Hi Tuck,
@tuckjohn wrote:
Oop! Turns out if you fail the CAPTCHA it removes your attached files. They're attached here.
Did you read the error explanation?
Error -200088 means "task is invalid or non-existant"! One (of many) bad thing of the DAQmx-ExpressVI: it opens and closes the DAQmx task with each call.
Again I recommend to stick with plain DAQmx functions - as are explained in ALL those example VIs about DAQmx in the LabVIEW example finder!