LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

time stamp each data point

Greetings all. An associate is trying to write a routine that will time stamp each data point acquired with a Keithley DAQ. He needs millisecond resolution. Whether it is an actual time stamp or the time between each data point does not matter. He tried to get the size of the array of data (number of point) and divide that into total time of acquisition but is having trouble doing it that way. Any ideas/suggestions????

Thanks
0 Kudos
Message 1 of 16
(5,109 Views)
I don't know why that approach should fail. If the acquisition takes 1 sec and 1000 points were acquired, 1 divided by 1000 gives a result of 1 msec between points. Explain in further detail what the problem is or if you posted the associates code, someone could look at it.
0 Kudos
Message 2 of 16
(5,109 Views)

I just read this post and I'm experiencing the same problem. I'm sampling 3000 samples at 25kHz however I only get a time stamp once every 3000 samples. Is there anyway to get a time stamp for each of those 3000 samples? How do you know for sure that  there is 1/25000 seconds between each sample?

0 Kudos
Message 3 of 16
(4,678 Views)

The time between samples is set by the sampling clock on the datra acquisition device.  Usually those clocks are derived from quartz crystal oscillators.  The accuracy should be in the device data sheet.  Even very inexpensive oscillators of that type have accuracies of about 50 parts per million (ppm). The timebase of the PCI-6221, a low cost multipurpose DAQ device has a 50 ppm timebase.  Some higher performance devices may have oscillators which are much better if you need more accuracy.

 

For your 25 kHz sampling the sample clock period is 40 us.  A 50 ppm error would change that by 2 ns.  The time of the 3000th sample might be off by 6 us or < 1/6th of one sample period.  Since the timestamp resolution is about 1 millisecond, this does not seem very relevant.

 

Lynn

0 Kudos
Message 4 of 16
(4,674 Views)

So there is still no way of recording the time stamps at a sub milisecond level? If I wanted to figureout the time for some data point inbetween the first sample and the 3000th sample, I'd have to linearly interpolate?

 

 

0 Kudos
Message 5 of 16
(4,646 Views)

You can calculate the time of sample i, T[i] = timestamp of sample 0 + (i+1)*dt, where dt = 1/fs and fs = sample frequency.

 

As far as I know, none of the standard DAQ VIs do this calculation for you.  Most people record the T0 and dt or fs and calculate anything else they need later.  Recording timetstamps which differ by exactly dt consumes a lot of storage space.

 

Recording individual timestamps is usually done only when the acquistion is software timed or has irregular intervals for some reason.

 

Lynn

0 Kudos
Message 6 of 16
(4,639 Views)

 

Thanks Lynn

 

I also wanted to add to my previous post:

 

I'm recording the DAQ measurements using the WritetoMeasurement.vi I've enabled X Value (Time) Columns however the time values provided don't match with what is actually happening or with Tick Count (ms). Does the WritetoMeasurement.vi use a different clock?

 

 

0 Kudos
Message 7 of 16
(4,637 Views)

I have not used that VI.  Perhaps someone else can answer.  Have you opened its diagram to see what it does inside?

 

Lynn

Message 8 of 16
(4,618 Views)

The Write to Measurement File uses the time information that you provide. With NI hardware/woftware, this would be from a waveform data type or dynamic data generated by the DAQmx driver. You hijacked this old thread so it is unclear if you are using the Keithley DAQ as in the original post. You need to provide that sort of detail and it would be even better if you attached your code. You are missing something basic but impossible to tell what.

0 Kudos
Message 9 of 16
(4,611 Views)

Sorry for the Hijack. I figured since a thread was already created, I'd just continue off it.

 

I've attached the code to this post. Basically I'm trying to record position data from an EPOS 2 24/5 motor controller and an NI USB DAQ-6210. I'm trying to record as fast as possible. 

 

What I don't know is if the measurement from the DAQ is synchronized with the reading from the GetPositionIS.vi. This was the rationale for getting time stamps at each of the 3000 data points.

0 Kudos
Message 10 of 16
(4,602 Views)