Example Code

Triggering Digital Output based on Analog Output Using LabVIEW with DAQmx

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

This VI outputs a sine wave, with a frequency determinable at run time via user input, and then outputs a digital spike every time the downwards crossing of the x-axis occurs.

 
Description

A sine wave is simulated, the frequency of which can be changed at run time based upon user input.  Thereafter, the value is measured and analyzed in comparison to the one before it, and when the x-axis is crossed from positive to negative a single digital high will be created.

The intended use case for this is threefold:

  1. In order to create code which outputs software-synchronized analog and digital outputs which can then be fed to a device using DAQmx.
  2. To replace the Simulate Signal VI with an analog input, to output digital spikes when the zero crossing occurs on the incoming data.
  3. As an example of a simple Producer-Consumer architecture in action, including queues and shift registers


Requirements

  • LabVIEW 2013 (or compatible)


Steps to Implement or Execute Code

  1. Download the attached VI, open and run it.
  2. Change the frequency input to the sine wave and observe the digital spikes move along with the changing frequency.

 

Additional Information or References
VI Snippet

002.png 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Chiara A
Applications Engineer with NI UK & Ireland

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.