From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.


Showing results for 
Search instead for 
Did you mean: 

how to trigger a event (in event structure) by output of comparison function

Go to solution





 I would like to triger specific event from a event structure with the output of comparison function. I tried several time but the output of the comparison function is not triggering. Please propose some solutions.





0 Kudos
Message 1 of 10

Currently how you are triggering the event... Can you post the VI you made?.... Please save in 8.6 Version and post...Smiley Wink


The best solution is the one you find it by yourself
0 Kudos
Message 2 of 10

Sounds like you need to write to the Value(Signaling) property. Writing to a local or Value property will not fire an event.

0 Kudos
Message 3 of 10



 Here is one example.  I would like to trigger the event case by having x=0? TRUE instead of the boolean.



0 Kudos
Message 4 of 10



 Here is one example.  I would like to trigger the event case by having x=0? TRUE instead of the boolean.



Download All
0 Kudos
Message 5 of 10

You haven't done what I said with the property node. Add that, add a timeout rvent, and move the stop button into an event. The stop button does nothing the way you have wired it. You can also place the numerics and the calculaions inside an event and not need a timeout.

0 Kudos
Message 6 of 10

As otheres have already mentioned, you first need to learn some LabVIEW basics. Dataflow!


The event structure is primarily to handle user interactions. What you need is a simple case structure.


The way you use the event structure, it will prevent the loop from spinning, thus the boolean will never change, because the numeric terminals never get read while the event is stalling. Similarly, as Dennis already said, your stop button is outside the loop, thus will only get read once at the start of the program and then ever again. Since you need to read it with each iteration, it needs to go inside the loop.


Why don't you run your VI in execution highlighting mode to get a better feeling about dataflow? 😉


You should also be aware that "equal" function should never be used on orange wires, because the limitations of floating point representation. In your case it is marginally OK because you enter the vaalues manually, but if you compare the results of computations, the results will be often unexpected. Change your demo to blue numerics (e.g I32 integers) for better determinism.


Anyway, here's a quick draft:


  • place the stop terminal inside the innermost loop
  • place a small wait in all polling user interface loops, else your loop will spin millions of times per second, consuming all available CPU.
  • Use a case structure instead of an event structure.
  • If you want the sound to occur only once when it changes from false to true, add slightly more logic and a feedback node (try it!)

0 Kudos
Message 7 of 10
Accepted by topic author Mlad

If you want to use an event structure, you need to react on the numeric inputs, e.g. as follows:



Note that the VI is idle unless one of the controls (x, y, stop) changes, at which time the booleans are updated, comparison made, sound played if needed, and VI stopped if stop is pressed.

0 Kudos
Message 8 of 10

I haven't done what you said with the property node because I still dont know how to work with it. A simple example will be great help.


Here I should say something more about what I want to do. I want to control a motor by those comparison functions. Let's say for x>0 move backwards, for x<0 move forewards and for x=0 stop. I know that event structure is usually  the right choice for this  but not for the VI  I am using. So it would be great if I can make it work with 3 cases of event structure.


Thank you ALL !


Best Regards,



0 Kudos
Message 9 of 10

  "If you want to use an event structure, you need to react on the numeric inputs, e.g. as follows:"


Thank you! I tried it and it works.

0 Kudos
Message 10 of 10