04-23-2026 09:09 AM
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.
Thank you!
Solved! Go to Solution.
04-23-2026 11:25 AM
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:
How well do you need to "synchronize" your data?
04-24-2026 12:48 PM - edited 04-24-2026 12:51 PM
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):
And I will echo some of Gerd's suggestions (emphasis mine):
05-01-2026 02:30 AM
Hello DSB.
After a bit of tweaking your solution ended up being the correct one. I especially didnt know the difference of TDMS and .lvm, as I was using a normal .lvm to store my data, which was giving me buffer problems. Things are working now. Thank you again.
Regards
05-01-2026 10:12 AM
@GasperB wrote:
Hello DSB.
After a bit of tweaking your solution ended up being the correct one. I
One more tweak may be necessary, if it has not been already fixed. In the solution, you have two different sample rates but are acquiring the SAME number of points for each loop. Adjust the number of points for each task such that Sample Rate x Number of Points equals the same time interval for both tasks, e.g., sample rates of 1000 and 500 would have Number of points 100 and 50 respectively.
05-01-2026 02:09 PM - edited 05-01-2026 02:12 PM
@mcduff wrote:
...two different sample rates but are acquiring the SAME number of points for each loop. Adjust the number of points for each task such that Sample Rate x Number of Points equals the same time interval for both tasks.
good catch: I forgot to change the name (and default value) of the control "Samples per Loop" which should have been renamed "block duration" and saved with default value of 0.1 s. The code was/is implemented such that each Read acquires the same duration of samples.
Definitely want:
task1(block duration) = task1(samples to read)/task1(sample rate) = task2(samples to read)/task2(sample rate) = task2(block duration)
I bet changing name and default value were some of the tweaks implemented by OP. ; )