Example Code

Synchronize Analog Readings with Digital Change Events and Record Acquisition Time In a Spreadsheet 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.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview

This VI monitors a digital line/digital lines and performs an analog acquisition every time there is a rising or falling edge on those digital lines.


Description
It uses change detection as the sample clock for the digital and analog lines. There is a counter input task that uses a clock to count edges so that the relative time in ms, since the program begins output with each analog sample taken.  The data is recorded in a spreadsheet.


Requirements

  • LabVIEW 2012 (or compatible)
  • NI-DAQmx 12.0


Steps to Implement or Execute Code

  1. Unzip the attached folder to your computer
  2. Open the VI "Simultaneous Analog and Digital Change Detection 2012 NIVerified"
  3. Ensure all digital and analog signals are connected to the appropriate lines on your device, select the corresponding lines in software and run the program.

 

Additional Information or References
VI Snippet

3-198.png

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

Gary P.
Applications Engineer
National Instruments

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