LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loss of data from last iteration of while loop

I have a write to measurement file espress vi inside a while loop that is writing data to the file every given interval of time.  When the total time elapsed reaches a given time (or the user stops the test) the loop ends and the program exits.  The problem I am having is sometimes I do not get the data from the last iteration of the given time interval.  How can I alter my while loop to fix this?  I have attached a jpg of my code.
0 Kudos
Message 1 of 5
(2,963 Views)
You are using way too many Value property nodes.  You are bound to have some race conditions, which is probably what is causing your problem.  You have wires going through objects making it hard to read your code.  Consider using wires instead of property nodes.  Also, property nodes are much slower.  See if you can simplify your code by putting some of the basic functions inside subvi's and then calling the subvi's from a main program.  The way your code is now, it would be a nightmare to find a problem.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 5
(2,959 Views)
I agree that the problem is likely a race condition.  I tried to follow the program flow of the boolean that controls whether or not the loop continues, but a lot of your wires are hidden.  I would recommend cleaning up the code, and then running highlight execution. 
0 Kudos
Message 3 of 5
(2,927 Views)
Changing some of the property nodes to terminals seems to have helped.  Thank you for your responses and advice to organize my code better.
~Jessica 
0 Kudos
Message 4 of 5
(2,912 Views)
And by terminals I mean wires...oops
0 Kudos
Message 5 of 5
(2,909 Views)