Synchronize Analog and Digital Output Tasks in NI-DAQmx with LabVIEW NXG

Updated Jan 26, 2018

Reported In

Software

  • LabVIEW NXG Professional

Issue Details

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

Solution

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

Figure 1: Synchronized Analog and Digital Output Signals
 

To achieve this synchronized performance, you need to accomplish two goals:

  1. Generate two waveforms that are correlated in the desired way (e.g. create a digital waveform that is driven 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 screenshot below, the correlated signals are generated by deriving a digital output waveform from the analog output waveform using LabVIEW NXG 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.

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.  

Note: A start trigger is not needed in this case since a sample clock is already being used to ensure that each output sample is synchronized between the tasks.

 

WAS THIS ARTICLE HELPFUL?

Not Helpful