ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating global controls

Hello,

I was wondering how I would go about creating a global control. I am not sure what is the conventional meaning of a global control, but I am specifically looking for a control that bypasses structures so that I can instruct an infinite loop inside a case structure to stop from outside the case structure. Thanks.

Andre
0 Kudos
Message 1 of 8
(4,649 Views)
To make a global, you'd want to check for a change on the control then wire the control into a Global Variable.  A global variable in LabVIEW is a variable that can be used anywhere in your project.
Message 2 of 8
(4,643 Views)
And if you just need access to this value within a single VI, another option is to create local variables of a front panel control.  I've used this trick before...make a hidden control on the front panel, and use local variables (and its terminal) to share a value between parallel loops on my diagram.

If you need access to the value in multiple VIs, however, the previous suggestion of using a Global Variable is the easiest approach.  Just watch out for race conditions...

-D
0 Kudos
Message 3 of 8
(4,635 Views)
Do a search for Functional Globals (Also called AE's or Action Engines).  They are a better way to implement what you want to do over a global control.  Another method is to use a queue.  But for what you are describing, the Functional Global is the easier approach.
Jon D
Certified LabVIEW Developer.
0 Kudos
Message 4 of 8
(4,634 Views)
Thank you for all your suggestions, however, my program still cannot perform the tasks I want. I can't seem to figure out how to use the global/local variables for my purpose. Perhaps I don't completely understand your advice so I created a very simplified program so that I can explain what I want to do. My aim is to start this program with the numeric value of 0 on the front panel, once I begin executing the while loop I want to be able to change that numeric value to 2 and stop the while loop. For my program I need for this control to be outside the while loop, and it seems once I have started looping nothing outside the loop executes anymore. I want to bypass this. Could you please demonstrate how I can use global/local variables to achieve this goal. Thank you.
0 Kudos
Message 5 of 8
(4,585 Views)

A very simple example using a functional global / AE is attached.  Let me know if you have any questions.

Jon D
Certified LabVIEW Developer.
Download All
0 Kudos
Message 6 of 8
(4,564 Views)

Thanks again for your help, but I was wondering if I could ask one more favour of you. I only have Labview 8.2, would it be possible to convert your files so that I can view them using this earlier version of Labview. Thanks.

 

Andre 

0 Kudos
Message 7 of 8
(4,560 Views)

Done.

 

 

Jon D
Certified LabVIEW Developer.
Download All
0 Kudos
Message 8 of 8
(4,553 Views)