ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to Measurement file at different Sampling Rates

Hello Experts,

 

I am new to LabView beyond the basic use. I am measuring data at two different sampling rates (1000 Hz and 200 000 Hz). I would like to write data to a measurment file (or files) and I need to make sure the data is synhronized. 

I have a cDAQ NI9185 with a NI 9203 (reading flowrate and temperature of a process continiously at 1000 Hz) and a NI 9222 reading from a fast pressure sensor at 200 000 Hz. How can I write this data and keep the times synhronized. example: Every 200 samples, one sample of the slower card is read, keeping everything in sync. 

GasperB_0-1776953247075.png

 

Thank you!

0 Kudos
Message 1 of 3
(138 Views)

Hi Gasper,

 


@GasperB wrote:

How can I write this data and keep the times synhronized. example: Every 200 samples, one sample of the slower card is read, keeping everything in sync. 


Several suggestions:

  • Don't use ExpressVIs, the will make your code more complicated in the end.
  • Learn basic DAQmx functions, as explained here and in all those example VIs in the example finder!
  • Read waveforms with DAQmxRead, so your measurement data automatically come with a timestamp (and dt).
  • Save all the data to a TDMS file (maybe even to different channel groups), so you got them in a compact data format.
  • As you write waveforms to the file you will ALWAYS have timestamps for each sample in post-processing!

How well do you need to "synchronize" your data?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(110 Views)

Because your 9185 automatically selects the chassis backplane clock as the master timebase, your code (just) needs to share a start trigger for synchronized measurements.
Try code like this (I modified a shipping DAQmx example):

dsbNI_0-1777052789030.png

 

And I will echo some of Gerd's suggestions (emphasis mine):

  • Read waveforms with DAQmxRead, so your measurement data automatically come with a timestamp (and dt).
  • Save all the data to a TDMS file (maybe even to different channel groups), so you got them in a compact data format.
  • As you write waveforms to the file you will ALWAYS have timestamps for each sample in post-processing!



Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
Download All
Message 3 of 3
(55 Views)