LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending an array of u8 by reference to a vi used in a subpanel

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?

0 Kudos
Message 1 of 4
(2,453 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,442 Views)

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. 

0 Kudos
Message 3 of 4
(2,412 Views)

@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).

0 Kudos
Message 4 of 4
(2,384 Views)