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.
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.
07-02-2012 10:19 PM
For example, I want to time for a period in a subvi, say 10 seconds, and I want to stop the main vi in time. How to accomplish this task? Is there any examples I can refer to?
07-02-2012 10:47 PM
If you want to stop the main VI while a subVI is running, simply use the producer / consumer design.
While the consumer loop may be locked up by the subVI, you still can use the producer loop to set a shared variable to make the subVI stop. Just add code in the subVI to check the shared variable.
07-02-2012 11:04 PM - edited 07-02-2012 11:05 PM
Hi,
The attached is one simple example I have seen:-
07-02-2012 11:15 PM
Look at another one:-
07-03-2012 01:52 AM - edited 07-03-2012 01:56 AM
Hi danil,
- The 1st example has no features that stop the mainVI after a given period of time, so it doesn't fit as an example for the question...
- Your 2nd example doesn't work because it violates the dataflow paradigm. You can't exit the mainVI as the event structure is blocked by your subVI...
Do you also test your "examples" before posting them?
Do you ever read the question of the OP before posting unrelated VIs?
07-03-2012 01:58 AM - edited 07-03-2012 02:00 AM
It seems to be working what we are trying.Can you please show the correct one that obeys dataflow paradigm.So that I can also study.
Sorry I just gave him a producer-consumer example.
07-03-2012 02:05 AM - edited 07-03-2012 02:13 AM
Hi danil,
zou already explained how to program the solution.
I would just use a (functional) global variable instead of a shared one for simplicity...
Simplest solution using a global variable:
07-03-2012 02:18 AM
Hi GerdW,
Thanks for your suggestion.