LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need subvi output without stopping program

Hi,

 

In my application I need to run the subvi 'Create ramp' once when a button is pushed. Then the 'Generate ramp' subvi runs, but I need this subvi output in real time for another subvi to run in the program. Previously this all worked because I had no subvi and only a big messy Vi but now I don't quite get how to make it works.

 

 

See here the output of 'Generate ramp' is needed for the 'PID' subvi.

 

 Capture.PNG

 

 

Thank you,

0 Kudos
Message 1 of 6
(2,752 Views)

Put a case structure around your subVI call.  Control the case structure with your button.


GCentral
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
0 Kudos
Message 2 of 6
(2,748 Views)

The thing is that the second Subvi includes a While loop. The problem is here I guess, I don't know how to make it without the While loop. 

 

Maybe it will be clearer with those images :

 

 

Capture2.PNG

 Manual1.png

0 Kudos
Message 3 of 6
(2,743 Views)

What you just showed there is a state diagram.  Meaning you should really be looking at a state machine.

 

And since it looks like you want to continuously generate a ramp pattern, you might want to look into using an Action Engine.  It could keep track of your elapsed time and position in the ramp array and update the output as needed.


GCentral
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
0 Kudos
Message 4 of 6
(2,729 Views)

Yeah if you want to design software based on a state transition chart, you might want to base your software on a state machine.  Here are a few links.

 

http://www.ni.com/white-paper/7595/en/

http://www.ni.com/white-paper/3024/en/

http://www.ni.com/white-paper/7604/en/

 

I think they are covered in Core1 and 2.

 

0 Kudos
Message 5 of 6
(2,703 Views)

I'm assuming that you are doing things a point at a time, with a loop around the "generate all the points" routine.  This is a fairly common LabVIEW Design called the Consumer-Producer (or Producer-Consumer) Pattern.  You have a Producer loop that generates data continuously at some rate in a loop.  To get it out of the loop, the usual method is to put it into a Queue, which also goes to the Consumer, which waits patiently for the data to appear and then plots it, does a PID, or whatever. 

 

In LabVIEW 2013, if you go to File, New, you should be able to find under VI/From Template/Frameworks/Design Patterns two examples of the Producer/Consumer Design Pattern that you can modify to suit your situation.

 

Bob Schor

0 Kudos
Message 6 of 6
(2,695 Views)