09-15-2005 05:11 AM
09-16-2005 09:11 AM
Hello again,
Thanks for your post.
There are a number of methods available for calling VIs, however I would like to clarify exactly what you are trying to achieve. I understand that you wish to have controls affect the behaviour of some subVIs, but I am lacking details.
-You say that you have a number of controls on your 'VItop' front panel (on/off switch(es)), does each switch relate to a subVI, or do these switches all control one subVI?
-Is 'VIsub' present on the block diagram of 'VItop', or are you wishing to call standalone VIs?
Some info on your current code would be helpful. If you could attach the relavent VIs to your reply and note to me which VIs are top/sub, and controls that are important.
I look forward to hearing back from you. Thanks,
09-16-2005 09:41 AM
Hi Rob,
Thanks for the response.
I've included a simple example showing something like my problem, basically duplication of code to handle the same action as generated by two different sources in two different level VIs.
What's the best way round this? As I mused out loud in the previous message:
1. Let each action (i.e. pressing the on/off button in the top and sub VI) generate a user event (in this case, is it possible to generate the event in the "on/off_sub" value change and then handle the user event in the same event structure?)
2. Let each action add an item to a queue, handle this queue asynchronously in VIsub, and let the sub and top level VIs populate this queue?
This is a lack of experience on my part to get to the bottom of this one!
09-17-2005 05:03 AM
Hi Probably,
Your event-registration solution was very clever! Here's a less sophisticated method that doesn't require an event structure in the subVI.
09-20-2005 02:45 AM
Thanks for that Dynamik...it seems like a more "tricky" or clever way of doing it than dynamic event registration.
Is your way more efficient though? You are polling controls at ~4 times per second, how does this compare with the overhead of using an event structure?
09-20-2005 03:46 AM
Dynamik, I've just thought about your code a bit more and I think it doesn't address the problem:
1. I don't want two buttons in Main.vi, one to close Main AND Sub and the second just to close Sub. I want one button in Main and one button in Sub, both doing the same thing in Sub.
2. Your Sub can't run as a stand alone VI, which is what I want
Maybe you could refine the idea?
Rob, I'd appreciate your feedback on my original posting.
09-23-2005 08:19 PM
Hi probably,
You're right in that the occurrance's timeout has been wired - in order to loop-periodically to poll the value passed by reference. The reference was just an Alternate example of how to get FP activity to the sub-VI. The occurrance, Unwired, would be sufficient - and efficient too.
09-29-2005 07:40 AM