07-26-2023 01:50 PM
Hi,
I'm using an NI USB-6009 to measure an analog input. I want to measure the time between triggers on this input. I'm using the 'trigger and gate' express VI, it does a great job of triggering, but I can't figure out how to measure the time between the triggers. Any suggestions are appreciated!
note: this will be done in real time with a DAQ card. The attached VI has a representative data set that I split into chunks to 'simulate' the DAQ readings
Solved! Go to Solution.
07-26-2023 01:54 PM
FYI there is a double pulse for each trigger. I'm counting this 'double pulse' as 1 trigger on purpose.
07-27-2023 03:36 AM - edited 07-27-2023 03:47 AM
with this slow samplerate simply do a peak detection (actually valley) 3-4 point width
see attachment
You really should try to use a higher samplerate 😉
EDIT: Oh one pulse ... which one to take first , second , mean of two ?
You need to use the hardware timing information (t0 and dt) .. the location information from the peak detection is sample based, with t0 and dt you can calculate the timestamp of your pulses and calculate the differenence.
I would use continious aquisition without the express vis to get snippets of the the waveform incl. t0 and dt
see shipped exsamples for continious aquisition as a starting point.
07-27-2023 04:15 AM - edited 07-27-2023 04:36 AM
build a better one
sometimes get the double pulse but that is easy filter 🙂
try samplesize 4 to get each trigger 😉 (and minimize or remove your delay :D)
you need to handle the timing information with your sampled data!
(at least the samplerate)
do you need subsample resolution ? peak detection will fitt a square on the pulse and migth allow that, but is a function of the shape of your trigger pulse
07-27-2023 11:37 AM
Hi Henrik,
Thanks for the reply! I neglected to mention I'm still on LV2012, are you able to post for that version?
07-27-2023 11:59 AM - edited 07-27-2023 12:02 PM
Re: sample rate
Agreed, I should definitely increase the sample rate. Historically the pulse amplitude and width was much greater. It's a pretty weak signal on the current hardware setup.
I've tried doing peak detection before but I get different results if I run it on the entire set vs. discrete samples. I get less peaks detected when it runs on the discrete samples. My guess was that it had trouble with pulses that land on the edge of the sampling window. Thats why I liked the 'threshold and gate' VI, it seems to buffer the data in a way that it doesn't run into that issue - unfortunately it's also a black box and I couldn't figure out how to get the timing information (sample #) out of it.
I don't need subsample resolution. But a quick response time is useful - eventually I'll trigger some other hardware when a peak is detected.
I'll take a look at your VI when it's converted to LV2012 🙂
07-31-2023 06:46 AM
here we go
08-08-2023 01:02 PM
Ah, the 'dt' parameter was the trick. Thanks! I don't have any experience with the waveform data type.
Also, I never noticed you could make a concatenating tunnel conditional - wow!! That's very convenient