LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you begin waveform timestamps at zero?

I am new to labview, writing my first program.  I am collecting 1000 Hz temperature data, the sample rate of which can be changed on the fly.  I have 12 channels of data, so I get an array of 12 waveforms.  I wanted to get the timing data from just one waveform, so I was able to use the "get waveform time array" vi to collect that information, but it displays the real time (number of seconds since 1903 etc), and I want my timing to start at zero when I begin the vi.  It needs to be accurate to the millisecond.  I thought that I could just subtract the time (in seconds since 1903) of when the vi started from each element of the array and I would then start at zero, but there appears to be some kind of timing error or lag time and the results I get always start the time somewhere between 1.000 and 5.000 seconds, (something like 1.458, etc), which is unacceptable.  I can easily fix the problem in Excel, but if anybody knows a better way around this problem, the help would be greatly appreciated.
 
 
0 Kudos
Message 1 of 5
(3,592 Views)
You should be able to accomplish that with just changing the time format to relative time.

Right click on the graph->Properties->Format and Precision->relative time...  that'll start it at 0, and you can play with the formatting strings to get it into milliseconds, or however you want it.
0 Kudos
Message 2 of 5
(3,584 Views)
I tried changing the waveform graph to relative time, and it displayed the time relative to the 1903 date system.  It looked like 890750:22 on the waveform chart, but changing that does not change the signals themselves, which is where I pull the time data from.  Any other ideas?  Thanks.
0 Kudos
Message 3 of 5
(3,580 Views)

rgehmlich,

I think the reason you're having trouble getting the timestamp to start at 0 is because the acquisition and the Get Date/Time in Seconds.vi are not happening at the same time. I think the system time is being read at the start of the program, and then the code goes through creating or opening the file, setting up the task, and doing the acquisition and all this probably takes between 1 and 5 seconds (with selecting the file to be opened). What I think would work better is to take the time information of the first waveform from the first iteration of the while loop and subtract that value instead of the Get Date/Time in Seconds value. I've modified your code to do this (and I took out the daq code and replaced it with an express VI since I don't have a daq card in my computer right now) and the timestamps start at 0 for me. Take a look and see if it helps.

Tyler S.

0 Kudos
Message 4 of 5
(3,552 Views)
TylerS, thank you so much for your input, that completely solved the problem.  I knew I needed something like that, but just didn't think of going about it that way...
0 Kudos
Message 5 of 5
(3,543 Views)