DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Clear Task doesn't release resources?

Solved!
Go to solution

I've created a DQMH module called "Analog Input". Its purpose is to coordinate/consolidate multiple analog input tasks (requested by other modules) that use different channels on the same piece of hardware. (My understanding is, for the cDAQ hardware I'm using, I can't have separate analog input tasks that use the same piece of cDAQ hardware, so this was my solution. Correct me if that's wrong!)

 

My module works well for creating new channel groups, updating the settings of those groups, and broadcasting data. However, when I try to remove a channel group, I get error -50103 at DAQmx Start Task (within my Process Remove Channels VI): "The specified resource is reserved."

 

To my knowledge, there's no way to remove channels from a task, so I'm having to first clear the task, then rebuild it using the remaining channel groups, then restart it. I can't figure out why I'm getting this error, though, because I'm using the DAQmx Clear Task VI to release the existing resources before rebuilding the task with the remaining channel groups and restarting the task.

 

Any help would be appreciated! Note: the error only occurs if there's at least 1 remaining channel group after I remove a group (otherwise the module won't bother trying to restart the task). So you'll have to use the Test Analog Input API to add a couple channel groups (I've been using simulated ones), then remove one.

0 Kudos
Message 1 of 4
(328 Views)

You might get more traction on this question by posting in the DAQmx forum

 

Have you reviewed/understood this?  It might help explain things: Task State Model - NI

 

Another thought - is it an ethernet based DAQ device you're using.  If yes, are you using these VIs?

Ozfarmboy_0-1725576763304.png

 

Christopher Farmer

Certified LabVIEW Architect and LabVIEW Champion
DQMH Trusted Advisor
https://wiredinsoftware.com.au

Message 2 of 4
(304 Views)
Solution
Accepted by topic author jrdwight

Hi Christopher,

 

That resource you linked was very helpful. I tried adding an explicit Stop Task and Abort Task prior to Clear Task as shown below, and that seemed to fix the problem! So it seems the Clear Task VI wasn't aborting the task (thereby releasing the resources) on its own. The Clear Task VI description says it'll abort "if necessary", so not sure how it determines whether it's necessary, but evidently it didn't think it was necessary in my implementation.

 

Good tip on posting in the DAQmx forum next time. And for the record, this was not for an ethernet-based DAQ device.

 

Jeremiah

Message 3 of 4
(267 Views)

Hey awesome.  Glad I was able to help!

Christopher Farmer

Certified LabVIEW Architect and LabVIEW Champion
DQMH Trusted Advisor
https://wiredinsoftware.com.au

0 Kudos
Message 4 of 4
(259 Views)