10-27-2022 09:18 AM
Hello, in the attachment there is an example of what I'm trying to solve in a more complex situation....but the stupid (I thought this) solution doesn't pass in my mind.
Input and output data are inside a while loop and all is working fine at VI level. But once created a sub_vi and imported it in a new vi the program doesn't work.
Thanks for your help.
E.B
10-27-2022 09:22 AM
If you can save the vi in a slightly older version (2018 seems to be very common still) more people will be able to help.
I am sure it is something simple... once I get to look at it.
10-27-2022 09:30 AM
I attach 2018 version
10-27-2022 09:35 AM
@brambo60 wrote:
Hello, in the attachment there is an example of what I'm trying to solve in a more complex situation....but the stupid (I thought this) solution doesn't pass in my mind.
Input and output data are inside a while loop and all is working fine at VI level. But once created a sub_vi and imported it in a new vi the program doesn't work.
Thanks for your help.
E.B
10-27-2022 09:50 AM
If you unzip the file you'll find both VIs
Not working means that in Test VI moving input output follow, in the Test Sub VI not.
10-27-2022 10:09 AM
When you run "Test sub-vi.vi", it calls "Test.vi".
"Test.vi" doesn't finish until the user clicks the "Stop" button *
But if you don't have the front panel of "Test.vi" open, you can't click the "Stop" button.
* That code is greedy; should use an event structure.
10-27-2022 10:11 AM
There is a fundamental flaw in your program. The sub-vi has an endless loop. IE. How do expect to press the "stop" button in your sub-vi?
10-27-2022 11:45 AM
You need to start with the basic tutorials about dataflow.
You also need to explain exactly what you are trying to do.
There are many other possibilities depending on what real problem you are trying to solve, so please explain exactly what the user does, and what he expects to see.
10-27-2022 01:49 PM
I realize that this may be a scaled down example, but you do need to explain a bit more what your ultimate goal is. Do you want to have a window pop up with the front panel of the subvi? If so then you need to set the subvi to open the front panel when called. Do you want the values of X and Y to be updated on the front panel as the subvi executes? If so then you should move the loop outside of the subvi as altenbach suggested.
10-28-2022 01:36 AM
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.