10-28-2022 03:06 AM
In your main complex VI you could have a state from your state machine, or an event that will fill a FGV with the boolean value to stop your subVI. In the subVI you read that FGV at a reasonable rate and you can exit your while loop.
But be careful where is done your FGV initialisation and set.
10-28-2022 03:47 AM
Thanks for your suggestion
10-28-2022 07:16 AM
@brambo60 wrote:
Yes, you have well understood. This is a scaled down example of a complex VI where more while loops are used.
As I don't want to open the Suv vi panel during the execution of Test sub vi, the answer of what expected to do is in your second question.
The solution to move the loop outside the sub_vi in order to implement in a Test sub vi it's clear and already used in others program I've. But applying this solution in a complex vi require a lot of modification. For this reason, I asked for this issue in order to verify if there was a simpler solution that was not present in my understanding, helping me to prevent in the future to fall into this situation again.
Thanks.
When I have a parallel subprocess I often generally use a queued message handler approach. I create the queue in the main prior to launching the subvi and pass the queue reference to the subvi. This allows for the subvi to loop based on messages received from the UI. If I need to pass data back to the main during operation I would probably use a user event. If you want to launch the subvi and forget about it until you are ready to stop you could use a user event passed in from the main or even a notifier. Note that this is ONLY if you're not changing input data during operation and are not interested in any data during operation (THINK DATAFLOW).