LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Separating Data Generation and Display

I have a Case structure which selects two sources of data. Within
each of the two cases is a loop that produces similar data in
different ways at a regular interval. Case 1 gets the data from the
network, case 2 gets it from a file. Say for example, each second it
generates a 40 byte string that contains data in a specific format.

I have also built a part of the program that separates all this data
and displays it on several graphs and many numeric displays.

But I can't figure out how to use my displaying section to show either
of the cases without duplicating all the stuff processes the data for
the graphs and numeric displays. I tried making a sub-vi, but since
you can't put front panel stuff in them, it ends up being a big
mess
with all the graphs and readouts I'm using.

Seems like a simple problem, but I just haven't been able to figure it
out.

Thanks in advance,
-Paul
0 Kudos
Message 1 of 5
(2,740 Views)
If the data that exits your case structure is of the same format, then all you should need is a single processing section and a single display section. These should be outside your case statement. If the data is not the same format, can you make it the same?

I also don't understand your statement "I tried making a sub-vi, but since you can't put front panel stuff in them". What exactly do you mean? All data in a main VI can be passed to a subVI and you can also pass references to front panel controls and indicators.
0 Kudos
Message 2 of 5
(2,740 Views)
>If the data that exits your case structure is of the same format, then
>all you should need is a single processing section and a single
>display section. These should be outside your case statement. If the
>data is not the same format, can you make it the same?

The data from both sources is in exactly the same format.

The problem is that the case selects one of two loops, and if I put
the data handling/display section outside of the case, then it is not
within either of the loops and doesn't update continously as the loop
executes. I need the display to update each time whichever loop I've
selected executes.

>I also don't understand your statement "I tried making a sub-vi, but
>since you can't put front panel stuff in them". What exactly do you
>mean? All
data in a main VI can be passed to a subVI and you can also
>pass references to front panel controls and indicators.

I have something like 20 readouts in the display section. So when I
tried to make a SubVI, it put all the logic in the subVI but had those
20 controls still in the main VI with 20 wires coming out of the
subVI. I did read a little about using the references to the front
panel controls in the SubVIs. Is there a way to automatically create
a subVI so that it uses references instead of creating all those
wires?

That might be the solution: create a subVI with references and then
put a copy of that display VI in each of the two loops.

Thanks for your help

-Paul
0 Kudos
Message 3 of 5
(2,740 Views)
Paul,
You can also create a local variable of your display and have the actual control in one case and its local in the other case(s).
If you do not want 20 wires going into the SubVI, you can frist group those 20 controls into a cluster, and then pass just one cluster wire to the SubVI.
Creating a subVI will not automatically create references. It will pass the data through the data wire type and not reference type to the SubVI. You can use the VI method "Set Control Value", but you will need to specify the control name and value.
Zvezdana S.
0 Kudos
Message 4 of 5
(2,740 Views)
If the only difference between the two loops is the source of the data, is there some reason you don't put the case inside of a single while loop?

The solution to that many wires in a subVI is to bundle them together inside the subVI and then unbundle them in the main.
0 Kudos
Message 5 of 5
(2,740 Views)