LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reserved resource error with multiple AI inputs

Solved!
Go to solution

I'm trying to do something that should be fairly simple, read three AI channels each on three tasks. The task LBHamps is on a cDAQ 9219 module channels 0, 1 & 2. LBHPSIin  is on channels 0,1, 2 on a 9201 module and LBHlpm is 3, 4, & 5 of the same module.  The problem I'm having is I keep getting an error -50103 "specified resource is reserved" from the last control task.vi of the three to initialize. It doesn't matter what sequence I run them in it's always the last one. Without the control task.vi I get a different but similar error about the resource being reserved.  

What am I doing wrong?

Capture.PNG

0 Kudos
Message 1 of 8
(5,379 Views)

You can't have multiple channels running multiple tasks with multiplexed DAQ cards.  The timing hardware is all in common (shares clocks, triggers, etc.) so all channels must run on the same task.  Combine your channels in one physical channel control, set your read VI to read multiple channels and then index your channels out of the 2D array that comes out of the read VI.

See here for how to set up multiple physical channels:

http://digital.ni.com/public.nsf/allkb/A3A05920BF915F1486256D210069BE49

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 2 of 8
(5,362 Views)

So you can't assign different tasks to the same module even if they use different channels? I've got a DIO module that I've got three tasks using it and it works.  Of course that's using counters so that might be a different animal. OK I can assign one task to the module and index the data but each of these tasks have a different scale. How can you assign scales to the data if they're all on one task?

 

Thanks

0 Kudos
Message 3 of 8
(5,352 Views)
Solution
Accepted by topic author GDthomas

@rtpumps wrote:

So you can't assign different tasks to the same module even if they use different channels.


Most analog input cards/modules use a multiplexer for the ADC.  So all channels you want to read from that card have to be in the same task.  You are getting the error because the ADC was already reserved.

 


@rtpumps wrote:

How can you assign scales to the data if they're all on one task?


You can define a scale in DAQmx by the channel.  Just create a DAQmx scale and apply it to the channels that need it.  Then you do not have to apply any scaling in your code since DAQmx did it all for you.

 

I also highly recommend using 1 task to read all of your data.  It will just make life easier.



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 4 of 8
(5,346 Views)

Ok I'll give that a try. I'm still not up to speed on some of the nuances of LV.

 

Thanks for the advice

0 Kudos
Message 5 of 8
(5,339 Views)

See Here

Capture.png

There are 4 Counter timing engines and for some modules all counters must be in the same task


"Should be" isn't "Is" -Jay
Message 6 of 8
(5,337 Views)

Thanks, that really clarifies things because I've got 4 counter tasks running on one 9401 module and it works. I didn't know there was a limit on tasks for each module.

0 Kudos
Message 7 of 8
(5,327 Views)

Crossrulz,

Thanks for the tip. I knew you could assign scales to different channels but I didn't know you could put channels from several different modules in a task. I put all the AI channels on one task and it made the code so much simpler! I've still a lot to learn about LV.

Message 8 of 8
(5,295 Views)