LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

subvi doesn't work from main vi

Solved!
Go to solution

Hello.

I'm trying to understand what I'm doing wrong.

I'm trying to control the subvi "justloop" from the main

"justloopmain" vi.

The subvi doesn't respond but when I try to make it work

as an independent vi it works fine.

As if the subvi is unresponsive as long as the loop runs.

How do I fix it and control the subvi form the main vi?

 

Thanks a lot!

 

J

Download All
0 Kudos
Message 1 of 6
(3,455 Views)

The sub-VI does work.  Are you concerned that the "Numeric" indicator doesn't update?  That's how data-flow works.  The sub-VI doesn't return until it's done, at which point your main VI will display the result.  Try running the main with the sub open and you'll see.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 6
(3,445 Views)
Solution
Accepted by topic author Jonnas

This is basic dataflow. When you start justmainloop.vi, the values of stop and Numeric 2 are read immeidately and passed to the inputs of justloop.vi.  Any changes to stop or Numeric 2 after that are NOT passed to the subVI. If stop is False at the beginning, then the subVI will never stop.

 

To control the subVI from the main VI you need several things.

1. The main VI must contain a loop so that you can repeatedly read the values of the front panel control.

2. The subVI must run independently of the loop in 1 so that the loop does not wait for the subVI to finish.

3. Some means of communicating between the independent nodes must be implemented. Queues or User Events can be used.

 

Lynn

Message 3 of 6
(3,441 Views)

Meaning that the subVI mustn't contain a loop

and the loop shoud be in the main VI?

0 Kudos
Message 4 of 6
(3,420 Views)

@Jonnas wrote:

Meaning that the subVI mustn't contain a loop and the loop shoud be in the main VI?


Exactly

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 6
(3,401 Views)
Thanks to all responders
J
0 Kudos
Message 6 of 6
(3,398 Views)