From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I fix errors with the daq being "reserved"?

I'm trying to read from the DAQ in a program, and in the program there is a large while loop that runs two smaller while loops. The smaller ones exit when a value read from the DAQ is a voltage higher than 1 volt. When I had only one smaller loop, I was able to read the values just fine, and It would exit as expected, but when I added a second, almost duplicate of the first loop, I began to get errors saying that the device was reserved and now niether loop can properly detect the value comming in from the DAQ.
 
How can I change the properties of the task or the read function so that it will not be "reserved"?
 
Thanks
0 Kudos
Message 1 of 6
(2,348 Views)

Hi,

You cannot read from other channels on the same device while it is already acquiring from a pre-configured set of  channels.

You have to stop this acquisition, reconfigure for the new set of channels and acquire.

The reason for this : your card shares a single ADC for all its channels.

And its timing sequence will be set for those channels in the currently configured scan list and hence the error if you try to start a parallel task

 

 

 

0 Kudos
Message 2 of 6
(2,341 Views)
Your program structure is not completely clear from your description. If the replies you receive are not enough to help you resolve your issue, please post your program.

One way to deal with this type of situation is to have the DAQ in an independent loop. Set it up to acquire all the channels at the highest rate required for any channel. Pass the results to the other loops via queues or LV2 style functional globals. This DAQ loop simply acquires data and passes it along. It does no processing of the data, or, at most, splits the channels and sends the data via different queues to the processing loops.


Lynn
0 Kudos
Message 3 of 6
(2,335 Views)
Well I've made it past my original error by taking out the two read funcitons and making one multiple channel single sample read function. Now though, my problem becomes this, I can't seem to send the data I read out of a while loop surrounding the read function. I can see the lines going out, but once they pass the border of the loop, the probe tool shows that their value is 0, as do numeric displays. How can I send out values from a running loop?

-Thanks
0 Kudos
Message 4 of 6
(2,321 Views)
To read teh data that is being acquired inside a while loop, You will have to pass data using a global variable
 
use a parallel loop and a global vatriable
look at attached example
 
Regards
Dev
 
 
 
0 Kudos
Message 5 of 6
(2,319 Views)
Or, use a queue. Or a LV2 style functional global (A VI with an uninitialized shift register in a while loop which runs one time on each call).

Lots of ways to solve the problem.

Lynn
0 Kudos
Message 6 of 6
(2,307 Views)