LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronize DAQ Analog Input & Digital Output (NI USB-6361)

I would like to synchronize a continuous digital output with an analog input on a NI USB-6361 DAQ. I want to press a button and have the digital output send a square wave at 47 Hz and have the analog input begin sampling at the same rate. I have referenced the following link http://digital.ni.com/public.nsf/allkb/EBD603683446EC13862575B3006A63A2, but I am still unsure how to implement this with a NI-DAQmx express VI.

 

I have attached a working copy of my VI.

 

Thank you,

Mackenzie

0 Kudos
Message 1 of 4
(2,967 Views)

Hi Mackenzie, 

 

To synchronize tasks like that you need to write out the code like they have in that article. The DAQ Assistant is an express VI that contains the Start Task VI through the Close task VI, so we can't syncronize between them since it has limited customization. 

 

Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications

http://www.ni.com/product-documentation/2835/en/

 

 

I would also look at this one, which will show you how syncing in LabVIEW works with your device:

Timing and Synchronization Features of NI-DAQmx

http://www.ni.com/product-documentation/4322/en/

 

Your code will probably look similar to Section 6 of the last article. 

Chase
NI Technical Support Engineer
0 Kudos
Message 2 of 4
(2,895 Views)

Hello Chase,

 

I read through both tutorials and produced the attached VI. Instead of using a digital output, I am producing square wave at the analog output. I am using this square wave to trigger a KeySight FieldFox (a portable spectrum analyzer). For now, I am using a 25 Hz square wave. When I run the VI, the FieldFox is triggered at 25 Hz while the analog input samples at 1 kHz until I stop the VI.

 

I then save the data on the FieldFox to a CSV file, which I compare to the DAQ's analog input data. I noticed that there is still an offset between their first timestamps. How should I arrange my VI such that the analog output and analog input start at the same time?

0 Kudos
Message 3 of 4
(2,883 Views)

I think the offset is coming from the fact that you are writing to the file at different times. Do you want to write the data to the same file starting at the same timestamp?

Chase
NI Technical Support Engineer
0 Kudos
Message 4 of 4
(2,863 Views)