12-02-2019 02:25 AM
I have an array of received serial data in my front panel that I want to use in a vi that runs within a subpanel. The subpanel runs different types of graphs and so far I have only been able to do this by using global variables.
By using global variables to system can't keep up with the data coming in, so I'm assuming that using references will allow the system to run much quicker.
Any ideas what the best way to do this is? I'm assuming that this is a common thing to do?
12-02-2019 02:42 AM
Hi lafox,
@lafox24 wrote:
By using global variables to system can't keep up with the data coming in, so I'm assuming that using references will allow the system to run much quicker.
Why do you think the global variables are limiting your VI/program?
Why do you think using (control) references will make your VI execute faster?
Why don't you use wires to forward data from main VI to your subVIs?
Displaying the VI in a subpanel is irrelevant in this context, more important is how you actually call your subVIs! Unfortunately you didn't tell us and you didn't attach any code…
12-02-2019 05:29 AM
I cannot see how to wire to the VIs if being used within a subpanel.
As you can see from the program attached I just need to access the array of data from within the VI.
12-02-2019 09:24 AM
@lafox24 wrote:
I cannot see how to wire to the VIs if being used within a subpanel.
As you can see from the program attached I just need to access the array of data from within the VI.
The VI in the sub panel can simply be updated when the data comes in. You can put any sub VI's front panel in a sub panel, so the graphs can simply be treaded as a normal sub VI.
Alternatively, the sub VI could get a queue reference from the parent VI. Or a channel wire. Or a user event.
A control reference is not recommended if you want to get all the values. If it's just the current values you're interested in, a control reference would work (but it would be ugly). If you want to get all values, some sort of queueing mechanism should be used (FGV, queue, channel wire).