LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Global Variable issue

So i am making a project for upgrading my skill set, i have Vi in which i am using Global variable and taking input from it and in other vi i am using same global vi for output so i have made a project and in that project when i open the main screen all there are button and on of the button is connected to vi that is collecting Global variable input, so unless i open that vi the data doesn't show up in other vi which has global variables output, please explain me if i am doing something wrong i want the data in global variable output vi without opening vi which has global variable input as it is running already right?  please help 

LaxTe_0-1757940743967.png

LaxTe_1-1757940980395.png

 

0 Kudos
Message 1 of 5
(197 Views)

Hi Lax,

 


@LaxTe wrote:

please explain me if i am doing something wrong 


You don't provide code, just some images of (parts of) code!

We cannot debug/edit/run images in LabVIEW…

 


@LaxTe wrote:

i want the data in global variable output vi without opening vi which has global variable input as it is running already right?


Inside the project all VIs have access to that global, so I don't understand your question…

 


@LaxTe wrote:

i am making a project for upgrading my skill set, 


Anyway: don't rely on global variables to transfer data between VIs.

Learn about wires, notifiers, queues, channels instead…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(180 Views)

Your 2nd image shows 2 problems/issues.

- The Open VI nodes are quite unnecessary, just set the VI properties to Open when called. 

- You have a clear race condition with your Global, there's no way to guarantee it's written before it's read.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 5
(144 Views)

@Yamaeda wrote:

Your 2nd image shows 2 problems/issues..


There are probably more than two problems....

 

You are not really telling us how you are running things. If a global variable has the front panel open, the values are displayed, but once the panel is closed, it would be a waste of resources to update the front panel. We really cannot tell how you are running things, especially since "untitled2.vi" (I am sure you could come up with a better name that hints on its purpose!) has no toplevel loop. We cannot say anything about the other VI because the architecture and VI name is outside the visible region. All we can see is a glaring race condition and meaningless invoke and property nodes.

 

As has been mentioned, global variables are rarely needed. You might be coming from a text based programming background and desperately looking for "variables" while stumbling across globals. In LabVIEW, "the wire is the variable" and it ensures proper order of execution.

 

I recommend to take a step back and explain what you are trying to do, now how you want to do it. I am sure we can come up with a much better solution!

 

 

 

0 Kudos
Message 4 of 5
(115 Views)

so i am uploading the full project here as you guys said it not possible to debug with just screenshots run the project  and then run the main file then in the back open the project folder and run the file named the data which i require without opening data.vi i want the data in global variable without opening the data.vi file 

0 Kudos
Message 5 of 5
(27 Views)