LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can not use Global Variable in Event Structure

Solved!
Go to solution

I am using LabVIEW 2009.

 

In my LabView project I have a Boolean Global variable called EStop. I can read and write the Global variable. If I double click on the Global variable, it takes me to EStop.vi which includes a Text Button. EStop.vi is part of my Project.

 

In one of my VIs, I have an Event Structure. If I go to one of the Event Handlers in that Event Structure and right click and then select Add Event Case, I get a list of possible events. But that list does not include EStop or an EStop events.

 

I want to Add an Event Case for EStop: Value Changed.

 

Why can't I Add events to an Event Case that include events on Global Variables like value changed?

 

How do I add EStop: value changed event to my Event Structure.

0 Kudos
Message 1 of 25
(8,768 Views)

That's not how global variables work.

 

Events are primarily designed to handle user interactions on the front panel.

 

What are you actually trying to do?

Why do you need to use a global variable?

How is the global variable changed during run?

What does the program do?

 

 

0 Kudos
Message 2 of 25
(8,761 Views)

No, you can't set an event for a global. Presumably, you already have an event for your stop button so monitor the status of the global and write to a value(signaling) property of the stop button to fire it's event.

0 Kudos
Message 3 of 25
(8,760 Views)

@Dennis Knutson wrote:

No, you can't set an event for a global. Presumably, you already have an event for your stop button so monitor the status of the global and write to a value(signaling) property of the stop button to fire it's event.


Why can't I monitor an event of a global variabl directly?

 

Your workaround seems fairly obscure and doesn't sound like it would work for many Global variables.

 

Isn't there a better, more direct approach?

 

How do I "write to a value(signaling) property of the stop button to fire it's event" ?

Can you show me a same that would accomplish what I am trying to do? Are there any examples?

 

THANKS for the help.

0 Kudos
Message 4 of 25
(8,750 Views)

@altenbach wrote:

That's not how global variables work.

 

Events are primarily designed to handle user interactions on the front panel.

 

What are you actually trying to do?

Why do you need to use a global variable?

How is the global variable changed during run?

What does the program do?

 

 


 

I have many events throughout the system that might need to cause the system to do an Emergency Stop action. So I want ro use a Global variable that is accessible from anywhere in the system. Any action or condition that occurs anywhere in the system can activate the emergency Stop condition by setting the boolean EStop Global variable to True. When the Global bolean variable goes true(value changed), I want to detect that event in an Event Structure and do the actions necessary to accomplish a system Emergency Stop.

 

Why don't Global variables work that way? Isn't this the type of purpose they should be designed for?

Why can't the value of Global Variables be read or written anywhere in th system?

Why can't the changing of a Global variable be detected anywhere in the system, suh as in an Event Structure?

 

Seems very strange indeed.

0 Kudos
Message 5 of 25
(8,749 Views)

As already mentioned, events are for front panel controls and a global is obviously not a control so it's not that strange.

0 Kudos
Message 6 of 25
(8,742 Views)

 


@dbaechtel wrote:
I have many events throughout the system that might need to cause the system to do an Emergency Stop action. So I want ro use a Global variable that is accessible from anywhere in the system. Any action or condition that occurs anywhere in the system can activate the emergency Stop condition by setting the boolean EStop Global variable to True. When the Global bolean variable goes true(value changed), I want to detect that event in an Event Structure and do the actions necessary to accomplish a system Emergency Stop.

 

Sorry, I am not familiar with your terminologies. What is your definition of a "system".

 

One big VI with many parallel loops?

Several VIs running in parallel?

 

 

0 Kudos
Message 7 of 25
(8,733 Views)

I don't want to have to poll the value of my Global EStop boolean value in order to detect that it has changed. That is why I am using an Event Structure (inside of a Sate Machine) and need to detect the event when the value is changed by any part of the application.

 

Is there any boolean flag or variable in the system (hopefully more than one) that can be set (and reset) by anywhere in the application, any VI, at any time; that can be detected as an event in a Event Structure?

 

What is the best way in LabVIEW 2009 to globally communicate (across multiple VIs) an important Event has occurred in a way that is compatible with an Event Structure inside a Sate Machine?

0 Kudos
Message 8 of 25
(8,732 Views)

System is the entire application, consisting of may VIs running in parallel, any one of which can have many control structures running in parallel, all of which communicating in many different ways and running at several priorities.

0 Kudos
Message 9 of 25
(8,722 Views)

Sorry, I am not familiar with the functions that you are using in your PNG. And as usual, the LabVIEW Help is not helpful in finding the operational details about the terminology you have used.

 

Can you provide a sample of the code you hav shown so that I can get some contextual help and be able to cut and paste the functions?

 

THANKS.

0 Kudos
Message 10 of 25
(8,718 Views)