08-23-2013 10:48 AM
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?
Solved! Go to Solution.
08-23-2013 11:17 AM
Use a local variable to clear the indicator before you call the subVI.
08-23-2013 12:28 PM
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.
08-23-2013 12:42 PM
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.
08-23-2013 02:56 PM - edited 08-23-2013 02:57 PM
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.