How to Synchronize Analog and Digital Input or Output Tasks in NI-DAQmx With LabVIEW

Updated Feb 19, 2019

Reported In


  • LabVIEW


  • NI-DAQmx

Issue Details

I would like to synchronize my analog output and digital output tasks in LabVIEW so that I can output digital pulses exactly when my analog signal goes above/below a certain level.  How should I do this?
How do I synchronize my analog input and digital input task in LabVIEW so that I can correlate between two events?


There are many applications which require synchronization between analog input/output and digital input/output tasks.  For example, one might need to output a digital pulse whenever an analog output signal goes above 4.5V or when it goes below 0.5V, as shown in the mixed signal graph below:

To achieve this synchronized performance, we need two accomplish two goals:
  1. Generate two waveforms that are correlated in the desired way (e.g. create a digital waveform that is high whenever the analog waveform is outside of a specified range)
  2. Output these waveforms in two separate DAQmx tasks using some form of hardware-timed synchronization

In the VI example below, the correlated signals are generated by deriving a digital output waveform from the analog output waveform using LabVIEW Comparison Nodes.  Sample clock synchronization is achieved by specifying the analog output task's sample clock as the sample clock source for the digital output task. See the snippet below or the attached example for more details. 

When the analog output task is started (assuming that the digital output task is already started and waiting for a sample clock), the tasks will run in a synchronized fashion, operating using the same sample clock, until the user stops the application.  

The following shows an example of Hardware synchronization between Digital and Analog Input tasks:

The same concepts for analog output and digital output apply to the input example.

Additional Information

A start trigger is not needed in the above snippet since a sample clock is already being used to ensure that each output sample is synchronized between the tasks.
You can also find an example of analog input and synchronization in <Program Files>\National Instruments\<LabVIEW>\examples\DAQmx\Synchronization\


Not Helpful