I'm writing some variables out to a binary file in real-time (xpos, ypos, elapsed time) with a while loop (see blockdiag.png). I'm using the time recorded by LabVIEW with an external devices clock to interpolate position values, before you ask, I don't have access to the external clock so interpolation is necessary after the data has been collected. Currently, the while loop is unabated and runs as fast as the CPU will let it. After I'm done collecting my data, I plotted up the elapsed time in MATLAB and noticed some very strange behavior, negative time (see clocks.png)!!!! The black data here is my external devices clock and the red data represents the elapsed time written out by LabVIEW. There are two instances in the vector that indicate a large negative step in time. This doesn't always happen and seems to occur somewhat spontaneously within the elapsed time vector.
Questions:
1) Has anyone seen this behavior before?
2) Would putting a Wait.vi in the while loop help? (I figured this would at least regularize the time step.)
3) Please help.
Much thanks, please don't judge my LabVIEW code (I'm sure there are better ways to do it, but it works and that is how I want it).
Adam