LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control the event structure

Solved!
Go to solution

What i am trying to do is when the condtion is true, i want the event structure to excute. But event structure wil not excute unless there the puch pattern changed, any idea how to do that ? 

0 Kudos
Message 1 of 5
(3,085 Views)

Do a Google search for LabVIEW Event Structure, read/watch some of the basics, and you should be able to solve your problem.  Hint -- almost all programs have only 1 Event structure.

 

BS

0 Kudos
Message 2 of 5
(3,064 Views)

Why would you use an event structure there?  The outer while loop is going to accept the boolean as an input which will remain true the entire time all of the code within the inner loops are running.  You can't change the boolean value at that point.  The way your code is written, the boolean will only be modified once.  Why not just use a case structure?

 

Avoid using multiple event structures when at all possible.

 

I'm guessing based on your code you're new to LabVIEW.  I'd suggest googling "data flow labview" before you attempt to take this code any further.

0 Kudos
Message 3 of 5
(3,061 Views)

Also, I'm guessing it's not the changing of the boolen that you care about, but the results of the "greater than?" comparison.  You may want to set up your event structure (AFTER doing all the reading recommended above) to check "greater than?"  whenever there is a "value change" event for either the "numeric" or "numeric 2" controls and then run different code based on the result (true or false).

0 Kudos
Message 4 of 5
(3,052 Views)
Solution
Accepted by Besho

It's more likely he wants the sequence of events he has put together to run after the result changes once.  If you change the logic to check the values after each change of numeric(2), he'll need to learn to check to ensure the last iteration wasn't already true.  Otherwise, he's going to start the sequence over and over.

 

Really, you need to get away from the event structure entirely.  It's not what you want.  Your code lends itself to a state machine very well.

 

You'll want to ask yourself a few things:

1) Do I want my code to run continuously or do I just want to check the two numerics once? (your code currently does the second)

2) Do I want the user to be able to stop my code once the sequence starts? (this is generally a yes)

3) Do I want Path 6, Path 5, or the comparison to happen first?  Do I want them all to run simultaneously?  Do I need one before another? (currently you cannot predict which will happen first.)

 

Topics you'll need to understand are: state machines, data flow, case structures, timing, and race conditions.  Right now, you're looking to get yourself into trouble.

0 Kudos
Message 5 of 5
(3,044 Views)