07-18-2013 12:53 PM
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
Solved! Go to Solution.
07-18-2013 01:32 PM
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.
07-18-2013 01:41 PM
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
07-18-2013 02:41 PM
Meaning that the subVI mustn't contain a loop
and the loop shoud be in the main VI?
07-18-2013 05:43 PM
@Jonnas wrote:
Meaning that the subVI mustn't contain a loop and the loop shoud be in the main VI?
Exactly
07-18-2013 05:52 PM