Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading from an ongoing sub VI

Hi. I'm using labview 8.6 and a DAQmx 6229 for PID control just as shown in this video http://www.youtube.com/watch?v=qMydcfZ_ZSs . I measure my voltage at ai1 and to keep at my set point I generate voltage at ao1. This all works well. My setup however changes every x milliseconds through ao2 so that the voltage needed at ao1 to keep ai1 at the set point changes. I want to be able to read that voltage signal from an analog input, lets say ai2.

If I just keep my PID loop running as a (It is disconnected from the rest of my vi or a SubVi) and just go about my business I have no problem generating the analog output at ao2 with a DAQ assistant but if I try to read from an analog input I get an error 50103, "The specific resource is reserved". So It's trying to do two things at the same time, but why can I generate a signal along side this PID loop but not read one?

If I simply can not run the PID control separately I have other ideas. As you can see the PID control is within a while loop. If I make the same DAQ assistant read for the PID control (ai1) and my other analog input signal, ai2. If I wire the ai2 signal to a chart indicator I can see my signal. That signal is however stuck inside the PID control loop. I need to be able to accumulate all the signals from ai2 and pass it out of the while loop every x milliseconds(so I have one bundle of signals from ai1 for every output signal at ao2).

 

I hope this is clear enough

Kiddi

0 Kudos
Message 1 of 3
(2,894 Views)

I don't know if I completely understand what's going on with your example, just thought I'd help you with your idea about reading both Analog Input channels in the PID loop.  If you want to use the data from the other channel outside the loop, you can use a queue.  Here's a community page that gives you an example.  (just delete the loop about local variables, you just need the producer and consumer loops)

 

For instance, your producer loop would be your PID loop from the video you were talking about.  It would "queue" up the data from the other ai channel, and then another loop would "dequeue" the data for use for something else.

 

that help?

 

-gaving

0 Kudos
Message 2 of 3
(2,887 Views)

Thanks. This helped a lot

0 Kudos
Message 3 of 3
(2,861 Views)