09-05-2024 11:50 AM
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.
Solved! Go to Solution.
09-05-2024 05:53 PM
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?
09-06-2024 04:59 PM
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
09-06-2024 09:26 PM
Hey awesome. Glad I was able to help!