From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

DAQmx Analog Input Software Trigger

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 code allows users to set up a trigger in software. This code can be useful for devices that do not have hardware analog triggers.

Description

The VI will configure a digital and analog task to any DAQ device. The program then starts the analog task to begin acquisition. The data that is acquired sample by sample is compared to the trigger level set. Once the trigger level is met the digital task will begin and write a single value out to a line on the device and stop the task.

Note: This VI uses software timing to compare and trigger the digital output. This response time of this VI to write the value will be slower than any hardware analog trigger and most likely will not execute in the same amount of time each time the VI is executed. This VI is meant to give users an analog trigger for devices that do not have hardware analog triggers and do not need high speed in their execution of the digital write.

Requirements

Software

  • LabVIEW 2013 or compatible
  • DAQmx 9.5.5 or compatible

Hardware

Any DAQ device with analog input. Most useful for those without a hardware configurable analog trigger

Steps to Implement or Execute Code

  1. Select the device and the analog channel you want to perform the analog trigger on.
  2. Select the device and digital line you want the digital output on.
  3. Configure the analog channel sample clock.
  4. Select the trigger type and the trigger level.
  5. Run the VI.

Additional Information or References


ExampleTriggerSnip.png

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

Noah | Applications Engineer | National Instruments

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

Contributors