LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event structure

hello i am building a program with an event structure where the program goes from an event to another using Boolean buttons, recently i decided to add a timer to the program where those buttons get pressed automatically after the time elapses , but I'm facing a problem where the programs stops in one event and don't go to the next event until  i press the button below is an example of what I'm talking about . thank you for the help.

0 Kudos
Message 1 of 5
(1,481 Views)

Your code makes absolutely no sense. First of all you have it running in an infinite loop (you have a false wired to the terminal of the main loop). I assume that this means that you're using the abort button to stop the program. You should add code to properly shut down the program.

 

Next, you have an infinite loop inside your "diode test 2" value change event. If you press the diode test 2 button then you're going to be stuck inside that loop.

 

Next, if you're trying to automatically trigger the "diode test 2" value change event from the "Cancel Button" value change event then you need to use the Value (Signalling) property node. However, you should do this after the time has elapsed.

 

You really need to reconsider your structure. It is not good practice to put loops inside of an event structure. A producer/consumer architecture would appear to be appropriate to what you're doing. Have you looked at the training material that is available?

Message 2 of 5
(1,465 Views)

hello, thank you for the reply .

 

first of all this is not the program , what i sent is only a basic program to show you what i need , so forget about how the infinite loop and how i stop the program ,my only concern is how to go from cancel event to diode event without me actually pressing the diode button with my mouse ,if you can help me with that.

 

thank you

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

Events are useful if the code typically does nothing except waiting for the user. In your case all you need is one outer while loop and a case structure, and maybe an event structure. (think state machine!). none of your inner loops are needed because you can use the outer loop to do the same. Don't get trapped in Aztec pyramids of loops on top of loops.

 

You can eliminate all local variables and inner loops. If you understand that latch action booleans reset when read by the code, you can define at what point they do by correct terminal placement.

Message 4 of 5
(1,438 Views)

@aasaleh024 wrote:

hello, thank you for the reply .

 

first of all this is not the program , what i sent is only a basic program to show you what i need , so forget about how the infinite loop and how i stop the program ,my only concern is how to go from cancel event to diode event without me actually pressing the diode button with my mouse ,if you can help me with that.

 

thank you

I already answered this:

 

@johntrich1971 wrote:

 

Next, if you're trying to automatically trigger the "diode test 2" value change event from the "Cancel Button" value change event then you need to use the Value (Signalling) property node. However, you should do this after the time has elapsed.


The part about the "you should do this after the time has elapsed" means that if you send it multiple times they're just going to be queued up because the next event can't run until the current event has completed.

 


@aasaleh024 wrote:

hello, thank you for the reply .

 

first of all this is not the program , what i sent is only a basic program to show you what i need , so forget about how the infinite loop and how i stop the program


 

Can you show us your real code, or at least an example that's more like your real code? Giving you advise based on this code could just lead to other problems since it is not the same as your real code. For instance, are there loops inside the event structure in the real code? Are there other events in the real code that needs to run? The structure that you show here could quickly get you to a user interface that is unresponsive.

 

 

 

0 Kudos
Message 5 of 5
(1,425 Views)