LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure in a while loop does an extra iteration

In this program, after the user has measured all the values, he or she will press a calibration complete button and the results of the measurement will be displayed.  However when the program runs and this button is pressed, the event structure does one more iteration.  Is there a way for the while loop to read the control before the event structure executes to prevent this?

p.s.  I know that the wiring is probably a lot more complicated than it needs to be so if there is a better way to place values into a particular space in an array let me know

Thanks

Chris O.
0 Kudos
Message 1 of 6
(2,835 Views)
Oops, forgot the attachment
0 Kudos
Message 2 of 6
(2,832 Views)
Handle the "Calibration Complete" with a different event case. In this event case all you have is just the Boolean control, and you send out its value to the loop control.
0 Kudos
Message 3 of 6
(2,828 Views)

Probably just a matter of the order of execution in your data flow.

Please post a VI so we can see what is going on now.Smiley Wink

Never mind.  You have since posted it.  SMerucurio's suggestion of a separate event case for the other button should work fine.



Message Edited by Ravens Fan on 06-30-2008 01:20 PM

For putting an element into a specific location of an array, look at "Replace Array Subset".  This should allow you to replace your groups of shift registers with a 1-D array since you are basically building 1-D arrays after your case structures anyway.



Message Edited by Ravens Fan on 06-30-2008 01:24 PM
0 Kudos
Message 4 of 6
(2,826 Views)
Re: your p.s.: You have duplicated code four times. It is generally better to use subVIs rather than to place duplicated code on a huge diagram.

I did not spend much time on deciphering what the code does, but Replace Array Element may be what you need. You may also want to initialize the shift registers.

Lynn
0 Kudos
Message 5 of 6
(2,819 Views)
Thanks a ton, all of you, that is exactly what I was looking for!
0 Kudos
Message 6 of 6
(2,799 Views)