06-03-2008 11:13 AM
06-03-2008 11:17 AM
06-03-2008 12:43 PM
06-03-2008 01:08 PM
06-03-2008 02:30 PM
06-04-2008 08:01 AM
So, if the sub vi runs, finishes all its tasks, and then stops, it is "completed" or "finished". Even if there is a timer running that will scan the keyboard?
Does this also apply to running sub vi's with lots of while loops, when they all "finish" and stop, is the sub vi "finished" or do you have to wrap the whole thing in a humongous (technical term from years ago) while loop and stop it to be "finished"?
Thanks a lot for your help!
Starting to Humm again.
06-04-2008 09:24 AM
06-04-2008 04:51 PM
06-10-2008 04:59 PM
06-11-2008 08:57 AM
I have decided to adopt the following strategy and would appreciate comments.
When I want to exchange status information, I will place the status "flag" in a global. One vi is thought of as being the executive. Each vi, including the executive will have a button (hidden or not) on the front pannel called "check flags". When a vi (other than the executive) changes a status flag, it uses the application control pallet / invoke node / control value / set vi to set the "check flags" button on the executive to true. This doesn't cause the executive to do anything, because I usually set all the button controls in a while loop which contains a wait for front pannel activity from the dialog and user interface control group. BUT, you can cause a front pannel activity to occur by using the dialog and user interface control group/ cause front pannel activity right after setting the check flags button.
The result of all this should be.
None of the vis are running except the executive, other than using whatever cycles it takes to "wait for front panel activity". The executive sets a "Do Your Thing" flag in one of the "service" vis. and causes a "check flag" event to occur on the front panel of the service vi. The service vi finds that a front panel event has occured and does a one cycle for loop which contains the references to all the flags. In the loop is an event loop which functions if any of the flags have changed. Inside the event structure is a case structure which uses the new value of the flag to dictate what actions should be taken. Since one of the flags changed when the executive changed it, the loop in the service vi operated, resets the flag, causes the service to be performed and then sets the "I'm done" flag in the global, then sets the "check flag" control on the executive, then causes a front panel change event in the executive and goes nicely back to sleep, waiting for another front panel event.
The flags can be watched on the front panel of the global for trouble shooting.
Now, whether this is more effecient than just scanning the global flags and looking for value change to cause events, I don't know. It depends on how many vis are sitting there polling, waisting energy....(got to think green these days). On the other hand, the speed of response to the flag change is now limited by the speed with which the control value set and cause front panel event functions occur rather than the amount of time waisted in the scanning loops looking for value changes.
That's what I think anyway.
Good luck.
the Humm