LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Append Waveform, keep time stamp

Solved!
Go to solution
Solution
Accepted by topic author COIEngineer

Use a case structure.  When i=0 but the waveform directly into the shift register.  On all other iteraation append the value from the shift register with the new waveform then put it in the shift register.

0 Kudos
Message 11 of 28
(1,954 Views)

I'm reading from a USB. Here is my attempt to initialize with a t0. As you can see, the t0 for the First run and that of the appended waveform are different. Essentially, I want a true timestamp from each of my samples. The ULx read data maxes at approximately 500 Hz, but can vary fairly significantly. I will need to append several samples to allow realtime calculations. If I drop a few samples because of a lag in read time, that's ok, but I'd like to be able to adjust for that by looking at the timestamp rather than a sample count.

 

If there is a better way to achieve that, I am certainly open to suggestions.

 

 

 

Appended Waveform example 2.JPG

0 Kudos
Message 12 of 28
(1,952 Views)

use Raven Fans advice in that case


"Should be" isn't "Is" -Jay
0 Kudos
Message 13 of 28
(1,945 Views)

The case structure looks like it does it, but I'm not sure I believe the results (so slightly different topic). I moved the sampling frequency up to 10 kHz, much faster than the one-sample read that is possible (500Hz). Even if I output to a different indicator for each of the loops, the timestamp is only incremented by 0.0001. Does this mean the data are being back-logged, or is this a false timestamp?

 

 

Thank you for your help. I'll go ahead and mark it as solved since the main question for the thread is answered.

0 Kudos
Message 14 of 28
(1,942 Views)

@COIEngineer wrote:

The case structure looks like it does it, but I'm not sure I believe the results (so slightly different topic). I moved the sampling frequency up to 10 kHz, much faster than the one-sample read that is possible (500Hz). Even if I output to a different indicator for each of the loops, the timestamp is only incremented by 0.0001. Does this mean the data are being back-logged, or is this a false timestamp?

 

 

Thank you for your help. I'll go ahead and mark it as solved since the main question for the thread is answered.


The timestamp coming out of the driver is changing by 0.1ms?  That means you are only getting one sample at a time.  You will overrun whatever buffer that instrument has quite quickly.  You need to be able to read a lot of samples all as once.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 15 of 28
(1,938 Views)
Are you really talking about the timestamp or dt? A sample rate of 10 kHz is a dt of .0001.
0 Kudos
Message 16 of 28
(1,930 Views)

I did that sampling rate only as a short-term test. From your response, it sounds like the timestamp comes from the device (not Labview). If that's the case, I think the problem is easily solved by, as you said, reading several samples at once. I only need 500 Hz, so it shouldn't be a problem.

 

Thank you!

0 Kudos
Message 17 of 28
(1,928 Views)

@Dennis_Knutson wrote:
Are you really talking about the timestamp or dt? A sample rate of 10 kHz is a dt of .0001.

I set the sample clock on the device very high, and put the read data on a loop (which as about 500 Hz timing), reading out a waveform.

0 Kudos
Message 18 of 28
(1,926 Views)
The timestamp comes from the driver (pc time) - not the device. The dt comes from the device.
0 Kudos
Message 19 of 28
(1,925 Views)

@Dennis_Knutson wrote:
The timestamp comes from the driver (pc time) - not the device. The dt comes from the device.

This is what I'm looking at, The results at the bottom are a new indicator from the case structure at the bottom of the diagram:

Appended Waveform example 3 - code.JPG

 

From each loop:

Appended Waveform example 3 - results.JPG

0 Kudos
Message 20 of 28
(1,912 Views)