LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx task not being cleared correctly

Solved!
Go to solution

Hello,

 

I have created a state machine structure which is designed to configure a number of different DAQmx channels for data aqcuisition (the section of code with some analysis indication is attached).

 

The first time I run this vi, I get an array with the specified task names in (with a blank first line), but subsequent executions throw an error that the task name is already specified, leading me to believe that the tasks are not being correctly closed down, but I'm not sure how to configure the close task vi in this case.

 

Also in the initialise state, I have placed an empty array which is obviously giving me my blank first line, but if I remove this, it breaks the vi as one of the case terminals is then unwired.

 

Would someone be able to guide me to a more correct solution, please?

 

--dave

0 Kudos
Message 1 of 3
(2,147 Views)
Solution
Accepted by topic author djroseman

Purely given this example, here's a few things I would change:

Use a FOR loop instead of a while loop.  No point in the Initialize case.  You want to use a Shift Register to add the channels to your task.  There should only be a single task for the thermocouples, one task for the oil system, etc.  See attached for a quick example.

 

From this example, I would think your error is coming from the fact that you are creating a 2D array of tasks.  And each row must have the same number of elements, and you are getting a bunch of NULL tasks.

 


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 3
(2,141 Views)

Thanks for that crossrulz, that makes complete sense to me.  I like the approach of having an array of enums on the input to the loop, it seems much cleaner than the standard state machine architecture.

 

--dave Smiley Happy

0 Kudos
Message 3 of 3
(2,115 Views)