Example Programs

Showing results for 
Search instead for 
Did you mean: 

Acquiring Data From 2 DAQ Devices at Different Rates, Then Writing Both Synchronously To TDMS


If you have two Data Acquisition (DAQ) devices, you may wish to acquire data from both of them, yet not necessarily at the same rate. However what if you want to acquire data from one at a rate of 1 sample/sec, and from the other at a rate of 1000 samples/sec; then write both to a TDMS file although ensuring that the two devices stay synchronised?

VI Snippet.png


The code initialises data acquisition for the two devices and sets the rate using the sample clock.

Then within the while loop, we read data on each channel and write this to TDMS file before closing the TDMS and stopping the data acquisition outside the loop.


LabVIEW 2009 or compatible

DAQmx 9.1.5 or compatible

Steps To Implement or Execute Code:

1) Select channels on DAQ device to acquire from (Device 1 and Device 2).

2) Select TDMS file to write to (either create a new one, or overwrite an existing).

3) Set the desired acquisition rate for each device (currently set to 1sample/sec, and 1000 samples/sec).


**This document has been updated to meet the current required format for the NI Code Exchange.**

Active Participant smoothdurban
Active Participant

I don't see how you can use 2 DAQmx starts without generating an error.

Member Tori.M

Hi smoothdurban,

What error did you see with DAQmx Start Task? You have to start two tasks for the two data acquisition sources that you have e.g. a voltage module and a current module.

If you are seeing an error code, if you go to Help >> Explain Error, you should be able to see a more detailed description of it. Hope this helps!

Member Tori.M

Hi mumuyumutou,

I've now attached the coding for 2010 as requested on your private message

Member raiboe

When the TDMS is created, what does the output look like? 

I need to create a program that writes to TDMS with respect to the same reference time from several different sampling rates.  The program I currently have, writes with reference to the que time, so the data with lower sampling rates are compressed to the top of the colums.  I would like to add blank spaces or repeat values for the data sampled at lower rates.

Would something like this program work?