LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

front panel calls a subvi that calls other subvi's

Solved!
Go to solution

Hello,

I'm having a problem calling a subvi from the main front panel, where that subvi calls other two subvi's. My two last subvi's in the hierarchy have references in order to see the outputs on the front panel of the subvi. While from the subvi references work and I can see the output, when I try to reference the references from the subvi I can't see the output on the main front panel.

I know how to reference objects but do I miss something? Thanks

0 Kudos
Message 1 of 17
(2,600 Views)

Could you post the code? I suspect you are not passing a reference somewhere along the line.

 

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 2 of 17
(2,560 Views)

I'll post it in a few minutes. I'm trying to reproduce my solution in a smaller scale as the program I'm currently working on is very big

0 Kudos
Message 3 of 17
(2,548 Views)

Here's some general advice for passing data from the SubVI to the Main VI.

1. Utilize LabVIEW's natural parallelism, use a design pattern with multiple loops (Queued Message Handler in LabVIEW 2013 is my favorite)

2. Use queues or notifiers to send data, it is much cleaner and easier in the long run (Notifier contains latest data only whereas the queue maintains the entire data history)

3. User event (while not generally recommended) can also be used to transfer data

 

Once we see your code we can make more specific recommendations for you.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 4 of 17
(2,541 Views)

Here is what I did in a smaller scale but it is exactly the same problem I have.

0 Kudos
Message 5 of 17
(2,540 Views)

I also have another problem. The for loop outside the flat sequence of the main SUBvi I put it there in order to go through the flat sequence twice, but only the second subvi is executed twice. It was a logic thing to do but it seems it is wrong..

0 Kudos
Message 6 of 17
(2,530 Views)

I believe you have a race condition with the Local Variable and the actual control in the SubVI. Delete the local variables and wire the control refnum directly to  the property nodes.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 7 of 17
(2,504 Views)

I did it, so now I have two controls in my SUBvi, but nothing happened. I don't know what the solution is to either to my two questions..

0 Kudos
Message 8 of 17
(2,487 Views)

Ok, I've looked at your code in more detail and the version that you posted works exactly as I would expect it to. Here's what is happening:

  1. Main Calls main SUBvi, passes a ref to the Main's "Meter" control
  2. In main SUBvi, we enter the for loop and pass the main SUBvi's "Meter" control ref to the subVi's
  3. SubVI1 executes, which takes 4 seconds, updating main SUBvi's "Meter" while executing
  4. The final value is passed up to "Main" (value = 4)
  5. SubVI2 executes, which also takes 4 seconds and updates main SUBvi
  6. The final value is again passed up to "Main" (value = 5)
  7. main SUBvi executes the second time, however the autoreset on the "elapsed time" is not working as you expect instantly returning true, and updating to a value of "4" and "5" for sub1 and sub 2 respectively

 

Instead of using AutoReset which I don't currently have time to understand how to make work, use the iteration terminal in the while loop in Sub1 and Sub2 and place the "Equal to Zero" function next to it, wire the output of that function to the "Reset" terminal on your elapsed time and I believe you'll see the response you are after.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 9 of 17
(2,476 Views)

@Charles_CLA wrote:

Here's some general advice for passing data from the SubVI to the Main VI.

 

3. User event (while not generally recommended) can also be used to transfer data

 

Once we see your code we can make more specific recommendations for you.


I'm curious, why do you say that. User events can be used to great affect and can be the right method for passing data under certain circumstances.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 10 of 17
(2,474 Views)