From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

indicate end of loop to user from subVI state information

Solved!
Go to solution

I hope I can describe this adequately since making an example would take some time.

 

I have a test that sets up a chip using a serial control scheme. This takes place in a subVI. When the control bits are all entered into the chip a flag is asserted. I want this flag to be displayed on the parent VI's front panel. The parent VI runs the subVI iteratively until all the test cases are covered. A user dialog box interrupts this main loop to give time for the user to physically move a probe. I would like to indicate to the user that the test conducted in the subVI is complete and he can move the probe to the next test point.

If I make a connection to the indicator in the subVI the indicator on the main front panel follows the state of the the indicator in the subVI through the first iteration but then remains that way even though the flag is cleared in the subVI when the new iteration is begun.

How do I get an indicator in the main VI to display the state of the flag in the subVI?

0 Kudos
Message 1 of 5
(2,265 Views)

Use a local variable to clear the indicator before you call 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 2 of 5
(2,257 Views)

Thanks for the suggestion but I'm not sure I understand. The node in the subVI is clearing every time it starts. The indicator in the subVI is in a WHILE loop and the indicator connected to the subVI is in a FOR loop if that makes any difference. The internal state that I want displayed is connected to a less than comparison operator so its output should be continuously reflecting the results of the comparison which at the beginning of the test is FALSE and at the end of the test TRUE. When it starts again it goes FALSE so I don't see how or why it should be cleared from the main VI.

 

When I probe it during a test run the state starts off FALSE and becomes TRUE when the test is complete. The loop in the main VI then changes one of the parameters passed to the subVI and it starts again. When it starts the state in the subVI is reset to FALSE but that is not communicated out to the main VI's indicator.

 

I have a terminal on the subVI for connecting to this state indicator and even though in the subVI this node is transitioning from 0 to 1 and back to 0 again the only transition that shows up is the one from 0 to 1 on the first iteration. After that the indicator connected to the termainl of the subVI simply stays ON (1) even though in the subVI it is toggling ON and OFF.

0 Kudos
Message 3 of 5
(2,250 Views)

How is the subVI updating the indicator on the main front panel. Do you simply have the indicator wired to the subVI's connector pane? If that is the case, you should realize that the indicator is not going to be updated until the subVI finishes. That is basic dataflow. There are numerous methods to update the main while a subVI is running including queues, references, global variables, etc. See the examples that come with LabVIEW, search for the topic (it is a very common question), or post your code.

0 Kudos
Message 4 of 5
(2,243 Views)
Solution
Accepted by topic author jmannnh

As Dennis said, it is a data flow issue.  The boolean value is passed out of the subVI only once the subVI has been completed.  At that point, your GUI indicator is set with the value coming out of the subVI.  What I am suggesting is to clear that GUI indicator just before running that subVI.  I does not affect the subVI at all, just the done indicator on your main front panel.


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 5
(2,220 Views)