LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do controls/indicators get updated when I use event structure in the code?

Hi
I use Event structure inside while loop, and notice sometime the controls/indicator doesn't get updated. If I want the controls/indicators/variable to be updated properly, where should I place them? Inside the event structure or inside the while loop or outside the while loop?
Thanks
0 Kudos
Message 1 of 4
(2,466 Views)
If you have a single event that updates a single indicator, the indicator should be wired inside the event that does the updating. If you have multiple events that update a single indicator, you can use a local variable of the indicator inside each event or use a shift register as in the attachment. A control will be updated whenever you change it from the front panel.
0 Kudos
Message 2 of 4
(2,454 Views)
When do you want the update to happen?  Usually if you want an immediate update, you place controls and indicators inside the while loop.  You should place controls before the event structure so that the event gets the latest control data.  Indicators should go after the event so that they get updated after processing.  All of this is inside the while loop so that on each iteration, the control gets read and the indicator gets updated.  If you turn on execution highliting (light bulb), you will see how the data flows.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 4
(2,452 Views)

If you use shift registers as in Dennis's example, and this is a toplevel UI program, it is sometimes advantageous to place also the indicators BEFORE the event structure, right after the wire leaves the left shift register. It gets updated equally fast and has the advantage that it receives the correct default data even if the event has not yet triggered.

 

0 Kudos
Message 4 of 4
(2,447 Views)