LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronizing Output and Input

Solved!
Go to solution

I have a USB-6361 connected with a BNC-2120 and I am trying to synchronize my ADC and my DAC without any additional equipment, what I basically would like to do is have both run for 10 Seconds and then save my ADC results together with the DAC trace. I have tryed the Synchronise Example for the X-Series but it isnt working at all. Now I have tryed to setup my own implementation but it still is not working at all, I have a random offset that I can neither measure nor controll and since the resulting ADC Signal is only very weakly influenced by the DAC I need to integrate over the right area.

 

Download All
0 Kudos
Message 1 of 12
(243 Views)

Hi Schreier,

 

LabVIEW/DAQmx comes with a lot of example VIs in the example finder.

There should be examples on how to sync DAQmx tasks: you may try to sync the task by using the AO sample clock as trigger to start the AI task…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(238 Views)

Yes there is, this is the example. I have tryed it and it doesnt work.

0 Kudos
Message 3 of 12
(234 Views)

The Errormessage is, that they are already the same.

0 Kudos
Message 4 of 12
(225 Views)

Two quick suggestions:

  1. Make the ai task the master task
  2. Route the ai/StartTrigger from the master (ai) task to the Start Trigger VI on the slave (ao) task. With the current screenshot/code the implementation specifies that the ai task should start on the ai/StartTrigger (which explains the observed error). If you don't want to switch which subsystem is the master, you could just try changing "ai/StartTrigger" to "ao/StartTrigger" in your code.

Sorry, I can't verify the suggestions with hardware available to me.

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 5 of 12
(157 Views)

Refer to Synchronized Analog Output Loopback to Analog Input Using LabVIEW with DAQmx 

In this case, the analog output task is the master.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
Message 6 of 12
(142 Views)
Solution
Accepted by SchreierP

I adapted your code with synchronization code found in this Sound and Vibration Toolkit subVI:
examples\Sound and Vibration\Audio Measurements\subVIs\sv_Synchronize DSA AI and AO Tasks.vi

Sync_ADC_and_DAC.png
This code worked for wrapback for DSA Devices (4468_BNC_Slot4/ao0 --> 4468_BNC_Slot4/ai0 and 4468_BNC_Slot4/ao1 --> PXI1Slot3/ai1)

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
Message 7 of 12
(131 Views)

@ZYOng wrote:

Refer to Synchronized Analog Output Loopback to Analog Input Using LabVIEW with DAQmx 

In this case, the analog output task is the master.


That reference demonstrates an analog start trigger, and that makes sense to keep the ai the slave task.

Good! the OP has choices.

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 8 of 12
(126 Views)

dsb@NI wrote:

@ZYOng wrote:

Refer to Synchronized Analog Output Loopback to Analog Input Using LabVIEW with DAQmx 

In this case, the analog output task is the master.


That reference demonstrates an analog start trigger, and that makes sense to keep the ai the slave task.

Good! the OP has choices.


Note to the OP:  in the linked example above, the AI analog start trigger means that the 1st AI sample will likely be taken some time *after* the 1st AO sample, when the trigger conditions are met.   If you simply remove the call to DAQmx Trigger.vi, the 1st AI sample will be taken at the same time as the 1st AO sample.  This is due to the use of a shared sample clock with AO as the master, AI as the slave, and AI being started first.

    FWIW, when AO and AI will have the same sample rate I tend to advocate the habit of using a shared sample clock *instead* of a shared trigger.  I think it's a good habit because the method extends more cleanly to multi-device sync.  A mere shared trigger leaves both tasks to generate their own sample clock.  When both tasks are on the same device (such as your situation right now), that won't matter because timing is derived from a common source.  But on distinct devices, those clocks have tolerances that can cause them to skew out of sync over time.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 9 of 12
(100 Views)

I have tried it as described in the Link and my AI0 never triggers.

0 Kudos
Message 10 of 12
(53 Views)