Passing Control value to sub-vi via connector input 
Author Message
 Passing Control value to sub-vi via connector input

Question is fairly generic. I have developed a sub-vi which is a simple
state machine design. It has a while loop with 3 states. The default state
is essentially checking a push-button(latch when pressed). When pressed it
executes one of other states once and returns to default. Pressed the next
time, it executes the other state and returns to default. Essentially it
toggles between two states(that send out a GPIB command). It works fine and
does exactly what I want to do.

Problem I have is, when I use this sub-vi(to build say a control panel),  I
create the controls that are eg wired to the inputs at this level. When I
execute this vi, press the push button for example, no data passes into the
sub-vi to write to the same control within it.

Is there a way to make this happen? That is, pressing the push button at the
top level, data 'writes' to the sub-vi control via the input within it's
While loop and execute approp, case? It does not do so. It only sees the
first state of the 'image'(for lack of being able to call it something else)
control and any subsequent presses of the button(T/F) does not pass into the

It seems wiring the control to that within the sub-vi(in a While loop) via
the connector input, to which the latter control is connected does not see
any subsequent states, as long as the while loop is running?

I know a While loop when running won't accept new values from outside it,
but it does from any control within it. But why won't it do so if a control
is created on the input, which is connected to the sub-vi control within the
loop at the main vi-level?

Hope I have not overdescribed it in so many words to cloud up my situation.


Mon, 01 Mar 2004 05:08:19 GMT  
 Passing Control value to sub-vi via connector input
If i got your problem, the solution is simple. Just remove the inside
while loop, as long as i think you already have a main loop. This way,
you will repeat the main loop once and again, and the state machine
inside the subVI, now a case structure, will select the state
depending on the button input from outside. Hope this helps

Mon, 01 Mar 2004 14:26:52 GMT  
 Passing Control value to sub-vi via connector input
If you trace through the program, you will find that data flows from
the top level VI down to the subVI, then the while loop in the subVI
will run and the program execution will stay there. Execution will not
come back out of the subVI until it has finished running. Because of
this, the front panel controls (in the top level VI) are not even
being checked.

The trick here is to not put a while loop in the subVI, or (if you
really want the while loop in the subVI) use references to check the
controls in the top level VI.


Mon, 01 Mar 2004 22:30:22 GMT  
 [ 3 post ] 

 Relevant Pages 

1. how can i use control reference to pass integer to a sub VI

2. extracting data from subvi via main vi before subvi is finished

3. Controlling SubVI connectors

4. Using control reference with a Sub-vi over a TCP VI Server connection

5. Using control reference with a Sub-vi over a TCP VI Server connection

6. How do I use server to control for sub-vi from a main vi

7. serial communication via Sub vi

8. dinamically changing and viewing values of a sub-VI (repost)

9. dinamically changing values of a sub-VI

10. dinamically changing values of a sub-VI

11. multicolumn listbox changing value in sub-vi

12. buffer to hold integer value w/sub main vi


Powered by phpBB® Forum Software