09-26-2014 11:17 AM
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.
09-26-2014 11:21 AM
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.
09-26-2014 11:30 AM
use Raven Fans advice in that case
09-26-2014 11:44 AM
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.
09-26-2014 11:46 AM
@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.
09-26-2014 11:51 AM
09-26-2014 11:52 AM
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!
09-26-2014 11:54 AM
@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.
09-26-2014 11:54 AM
09-26-2014 11:59 AM
@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:
From each loop: