LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel Loops and Event Structure

Solved!
Go to solution

Hi,

 

Is attached a valid way of using the event structure?  I always hear that the event case should contain the control of the event.  Can the control be placed else where?  For example, if I have 2 loops, I placed an event structure in the 1st loop and the control associated with the event in the 2nd loop, would there be any potential problem?  Is it true that regardless where a boolean with a value change is read, the value chagne in the event structure will be fired?  See attached. 

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 5
(3,949 Views)
Solution
Accepted by topic author jyang72211

That screenshot you posted should work just fine for you.

 

The main reason you hear that the event case should contain the control for the event is so that the control gets read, and for latching booleans, gets reset when the event case executes.

 

Here since the parallel while loop is executing (assuming nothing else in the loops causes the loop to get blocked), the stop button will get read and reset.  The value change event will still be fired in the upper event structure loop.

Message 2 of 5
(3,947 Views)

So is the only reason of placing the control in the corresponding event case to reset the control?  We don't really need to read the value from control directly from the control, since ther terminal of the event structure would give me the value of the control, correct?

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 3 of 5
(3,938 Views)

Correct.

 

You can either read the terminal in the event case, read the New Value node inside the event case, or in the case here where you just care that the boolean changed because you can pretty much assume the stop button was false to begin with, you aren't reading the boolean value at all in the event structure and are just relying on the fact the event case was fired.

0 Kudos
Message 4 of 5
(3,932 Views)

@jyang72211 wrote:

So is the only reason of placing the control in the corresponding event case to reset the control?  We don't really need to read the value from control directly from the control, since ther terminal of the event structure would give me the value of the control, correct?


That, and it makes it easy to find if you in general place controls in their event cases.

/Y

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

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