LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question-DAQmx: Using multiple channels on a single device with a trigger

Solved!
Go to solution

The purpose of the attached VI (Switching_Controller.vi) is to wait for a trigger signal from the input and output a pulse whenever it occurs. However, at the same time I want to output and read a single sample from another input and output channel pair (behavior in Main_Controller.vi). I was planning on doing this in two parallel subvi's but I am running into the common error -50103, "specified resource is reserved". I understand that in order to address this issue I need to compress all output channels and all input channels into just two tasks. However, I am having trouble addressing the issue of the trigger, since I want the second set of inputs and outputs to happen continuously and the trigger forces the task to a certain rate of repetition. Is there any way to run a multichannel task in two parallel subvi's?

 

Thanks in advance for the insight.

Download All
0 Kudos
Message 1 of 5
(2,748 Views)
Solution
Accepted by topic author bnozbay

Hello!

 

Thank you for posting to the NI Forums! "Resources reserved" is a common error and it seems that you are aware of its source. Using two tasks of the same type at the same time without having anything in between that uncommits the resources will not work. Your best option here would be to combine all of your AI into one task and all of you AO into another task. 

 

What you could do is use an available analog line that you can monitor and implement some logic with something like a case structure to insert a value to an array, display it, log it, or whatever else you want to do with it when that analog channel crosses some value that you are looking for.

 

You could include your other AI/AO in the tasks and just have them acquiring/outputting as normal.

 

Hope this gets you going in the right direction. Have a great day!

Regards,
Margaret Barrett
National Instruments
Applications Engineer
Digital Multimeters and LCR Meters
0 Kudos
Message 2 of 5
(2,721 Views)

Hi, thank you for the direction! I almost have the program working as it needs to be, I'm just stuck on one step that probably has a simple solution:

I have 3 outputs on a single task. Two of those outputs need to be a constant value, which I have been doing with Nchannels, 1 sample. However the third output is supposed to be a waveform. Is there any way to put the outputs in series and have a DAQmx that writes the first two outputs followed by a write for the waveform?


0 Kudos
Message 3 of 5
(2,697 Views)

Hello!

 

Take a look at the attached screen shot. I wrote a small (and very simple) example that I think you'll be able to modify for your needs. Basically, we can use the start task to avoid getting resources reserved and break the task apart so that we write 1 sample on n channels and then write a waveform on a another channel. 

 

You will notice that I needed to enable the "autostart" function of the DAQmx write for the waveform data by writing a true constant to the vi. This way, the vi will start on its own with a start vi.

 

Hope this helps!

Regards,
Margaret Barrett
National Instruments
Applications Engineer
Digital Multimeters and LCR Meters
Message 4 of 5
(2,673 Views)
That worked for me, thank you for the help.
0 Kudos
Message 5 of 5
(2,663 Views)