LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can not use Global Variable in Event Structure

Solved!
Go to solution

 


@dbaechtel wrote:

I don't want to have to poll the value of my Global EStop boolean value in order to detect that it has changed. 


 

Why not? If you have such a large and complicated system, polling a global a few times per second is peanuts in the grand scheme of things. Place a tiny while loop in parallel to the rest of your code that polls the global, and if triggered, fires a signaling value property node, triggering a stop event in all event structures.

 

Still, I have the nagging suspicion that you are trying to paint yourself into a corner by fixating on a solution that will seem silly once you are more familiar with dataflow programming. I have the feeling that you have some serious misconceptions about event structures and dataflow in general

 

Can you show us some code so we get a better feel of the situation?

0 Kudos
Message 11 of 25
(6,639 Views)

I already have a State Machine with an Event structure already setup to control the system. I don't want to add polling to make it work if I don't have to.

 

This is the best description of the functionality that I need:

 

"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?"

0 Kudos
Message 12 of 25
(6,635 Views)

Can you use a Val(sgnl) on any Control or just stop?

 

What function is used to execute val(sgnl) ?

 

0 Kudos
Message 13 of 25
(6,625 Views)

The png I posted is a snippet and is code. Drag it to a block diagram.

 

The value(signaling) property is the way to programattically fire a value change event. It is not limited to a stop button.

 

0 Kudos
Message 14 of 25
(6,621 Views)
Solution
Accepted by dbaechtel

Define a user event as shown in the attached example, and create a corresponding global variable.

Use this global anywhere to generate an event.

 

 

19799i02A2A3EA9B683972

 

 

19801i1C77DBD7EBE4BA55

 

Chilly Charly    (aka CC)
Message 15 of 25
(6,612 Views)

Just what I needed.

 

THANKS.

0 Kudos
Message 16 of 25
(6,599 Views)

How do I drag your code out of GMail and into LabVIEW?

 

I cn not seem to find a way to do it.

0 Kudos
Message 17 of 25
(6,594 Views)

Direct dragging the snippet to the block diagram should work. Don't know how Gmail works, but you should have somewhere two files named "Generate Global event.png" and "Global event management.png".

Anyway, I have attached the vis.

Chilly Charly    (aka CC)
0 Kudos
Message 18 of 25
(6,591 Views)

Missing code for Global eveny.vi.

 

Can you include it as well?

 

 

0 Kudos
Message 19 of 25
(6,590 Views)

 


dbaechtel a écrit :

Missing code for Global eveny.vi.

 

Can you include it as well?

 

 


Global event.vi is just THE global. No missing code here ! 😮 😉

Chilly Charly    (aka CC)
Message 20 of 25
(6,575 Views)