07-24-2017 11:08 AM - last edited on 11-26-2024 05:26 PM by Content Cleaner
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
07-25-2017 06:39 PM - last edited on 11-26-2024 05:27 PM by Content Cleaner
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
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
Your code will probably look similar to Section 6 of the last article.
07-26-2017 06:08 AM
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?
07-27-2017 03:43 PM
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?