LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure in sequence structure troubles

Hello, for class I have to write a simple LabView calculator but I'm having some issues. This is my first taste of labview so I know the code isn't the best but I just would like to know what's causing my hang up. I have two similar event structures with in a sequence structure. When I run it it goes through one loop of the while loop and then hangs, I tried stepping through it but can't figure out where it goes. If I don't have the second event structure it works more or less fine. Been working on this all day and hit this wall. Thanks.

0 Kudos
Message 1 of 3
(2,910 Views)

You cannot have two event structures like that. Event structures queue up events, even if they cannot react to them because of dataflow. Your second event structure will also queue up all the events, but cannot execute them because it is not in the dataflow. In addition, your events are configured to lock the front panel until the event completes, and since some events can never complete, your panel is locked up forever.

 

Don't duplicate code twice, just keep state (A or B) in a shift register and do everything in a single event structure in a single loop.

 

What prevents you from hooking up the numeric terminals and buttons? Try to eliminate all these local variables keep the data in a shift register instead. Place each button terminal inside it's assiciated event and make them latch action. Now you can use "value changed" events instead of "mouse down".

0 Kudos
Message 2 of 3
(2,905 Views)

To continue on Altenbachs post, since you're reading from Local datacopies (local variables) your "goto b" will most probably not be synched with your stop button, meaning you'll leave the loop the next time you press a key. The 2nd event structure have been queueing up all events from the 1st one (as they listen to the same) and will perform them all before you can add anything.

 

Also, since the 2nd event loop stops uses the Stop button the program cannot stop until you've left the 1st one ...

 

You'll only want 1 event loop, but simple control where you'll write (A or B) and you'll need to wire to the stop button to avoid race conditions.

 

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 3
(2,886 Views)