LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Data from inside a while loop of a sub VI into the main VI

Just a quick check

 

I have a subVI. In it I have numeric indicators with a value 2, in a while loop.

My main VI calls the sub VI 's numeric indicator.  Will my main VI indicator shows 2 or 0?

 

Assuming it shows 2, then it must be something wrong with my sbrio.

If it is 0, how can I make it to show 2 instead?

0 Kudos
Message 1 of 15
(4,236 Views)

How are you passing the data from the sub VI to the main VI? Are you using the Invoke methode and the Reference?

0 Kudos
Message 2 of 15
(4,230 Views)

You are going to have to show some code.  I don't understand what your situation is.


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 3 of 15
(4,229 Views)

1.JPG

2.JPG

 

First picture is my main VI, second picture is the sub VI. Right now, "ALL OTHERS" in Main VI is showing 0 instead of different values.

0 Kudos
Message 4 of 15
(4,218 Views)

Your subVI has to complete before your while loop can actually loop.  In fact, your subVI has to complete before you get any data out.  Furthermore, your subVI will never exit unless you have Stop set to true BEFORE the subVI is called.

 

I think what you really want is to turn that subVI into an Action Engine.  Remove the wait inside of the subVI.  Have the loop only iterate once (wire a TRUE constant to the stop terminal, get rid of the Stop input).  Remove the 0 constant from the shift register initializing.


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 5 of 15
(4,210 Views)

Ive uploaded the subVI for your better understanding of my purpose.

 

Actually the case structure has 4 cases, different values each case. It will loop back to the1st case after the 4th case. Before going to each case, there will be a delay.

 

0 Kudos
Message 6 of 15
(4,205 Views)

That's just the subVI.  What about the main?

 

Again, this subVI will never exit and you will therefore never get your values out.  The reason this subVI will not exit is because you are wiring the stop value in.  It is simple data flow, you pass a FALSE into the subVI and the value will always be FALSE.  It doesn't matter if you change the value of the stop button of the main VI because the FALSE has already been passed to the subVI.


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 7 of 15
(4,178 Views)

You need to use a reference to the indicator in your main that you want updated by the subvi.  A reference points to the memory location of the main variable.  In the subvi, you write to the reference and the main gets updated immediately without waiting for the subvi to finish.

 

Study the two attached VIs.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 15
(4,154 Views)

For some reason my VIs did not get attached.  I'll try again

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 15
(4,152 Views)

One more time, using Google Chrome instead of Internet Exploder (typical Microsuck piece of crap)

 

 

YEAH! It worked.  Can someone tell me why IE doesn't work with this site anymore?  The site even looks different with Google Chrome.

- tbob

Inventor of the WORM Global
Download All
Message 10 of 15
(4,148 Views)