07-08-2010 05:08 PM
If you are concerned about appearances and can't/won't switch to a RTOS, hide the jitter present in the OS and windows clock by writing the start time as a header and write elapsed time in the first column. For 1 second loop time, you would have 0,1,2,3, etc. Base what you write on the iteration terminal and your period setting.
07-08-2010 05:17 PM
I duplicated your code minus the DAQmx stuff, and sending data to an array instead of a file. I got timestamps accurate to the millisecond. Notice in the picture, the milliseconds reads 7187 in every array element. Could be that the file write is taking too long. Instead of writing to the file each loop iteration, just store it to an array and write to the file at the end.
07-08-2010 08:04 PM
thanks tbob, a very interesting observation. however, I can't seem to duplicate your results to my computer. could you attach your vi so that I can test it here?
07-08-2010 08:20 PM
I just ran your latest attached vi and got very consistent results. I guess my computer is better than yours.
I have attached my vi,'
07-09-2010 07:22 AM
tbob brings an interesting point.
Does your PC have a multicore CPU?
07-09-2010 07:42 AM
haha, I am even more confused now. I think I'll have to install labview to another computer just to see what happens. I'm now running it on a Dell Latitude D420 with 2gb ram. It should be fast enough for a simple task like this? The CPU load is never above 50%.
Running the data to an array and saving in the end is not an option as the logging can go on for hours and days. The array could become very large, and in the event of a system crash all data would be lost.
Even if I could use this solution, I am still experiencing the same problem even with your timestamping.vi
07-09-2010 07:46 AM
yes, it has a multicore cpu, see attached file
later I will build an exe-file and deploy the code to another machine, but I don't know the specs of this one yet
07-09-2010 10:05 AM
My computer uses an Intel Xeon CPU running at 2.13GHz with 3G of RAM. I'm at a lost to explain why it is so accurate here but not with your computer.
07-09-2010 10:42 AM
With a multicore machine, you could setup a producer loop to acquire the data and pass it to another loop that will take care of writing it to a file. Each loop could be assigned to a seperate core of the CPU.
07-09-2010 10:56 AM
@Ray.R wrote:
With a multicore machine, you could setup a producer loop to acquire the data and pass it to another loop that will take care of writing it to a file. Each loop could be assigned to a seperate core of the CPU.
But I didn't have to do that and it worked fine. Something screwy here.