Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Triggering Data Acquisition

Triggering allows for an acquisition or generation to begin when a condition is met. For example, most function generators can output a pulse to notify you that the generation has started. With digital triggering, you can begin acquiring at the precise moment that the digital pulse is received. This module illustrates how to use a digital trigger to start an acquisition in NI LabVIEW software.


Step-by-Step Procedure

Download the Step-by-Step Procedure PDF

Before starting this procedure, you need to complete the exercise and use the solution in the Taking a Measurement module. You can also create a numeric control to simulate the data acquisition input.
Note that hardware triggering is not available on all NI data acquisition devices, including the NI myDAQ. Ensure that you are using a device that supports hardware digital triggering, such as the National Instruments Educational Laboratory Virtual Instrumentation Suite (NI ELVIS) II.

  1. Connect a 5 V trigger source to the PFI0 terminal of your DAQ device – you can also achieve this by simply connecting a wire from PFI0 to the +5 V rail of your device
    1. You can locate the device pinouts for a DAQ device by searching for your device online at ni.com
    2. The user guide and specifications contain this diagram
    3. Or right-click your device in Measurement & Automation Explorer (MAX) configuration software and select Device Pinouts
  2. Double-click the DAQ Assistant to open the configuration window
    1. Right-click Voltage in the Channel Settings window and select Change Physical Channel…
    2. Ensure that the proper analog input channel is selected for your device
  3. Navigate to the Triggering tab of the DAQ Assistant configuration window
    1. Select Digital Edge for the Trigger Type
    2. Select PFI0 for Trigger Source
    3. Select OK to apply configuration settings
  4. Run the VI
    1. Notice that the acquisition does not begin until the digital trigger is received

Note: If the stop button is pressed, and the trigger has not yet been received, the program does not stop unless you press the Abort button.

You can convert your DAQ Assistant Express VIs into low-level NI-DAQmx functions by right-clicking the DAQ Assistant and selecting Generate NI-DAQmx Code. The low-level NI-DAQmx API exposes more functionality and customization options for programming.

LabVIEW Example Code

Right-click on the above VI snippet and select Save Image As... Locate the file on your hard disk and click and drag the file icon onto your LabVIEW block diagram. LabVIEW automatically generates the code from the VI snippet. For more information, read VI Snippets.

Don’t have NI-DAQmx installed on your PC?
Download the latest version of NI-DAQmx.

Module Exercise: Triggering Data Acquisition

Download the Module Exercise PDF
This exercise cannot be performed on a NI myDAQ.

Exercise Goal
Use your NI ELVIS II device to acquire 1000 analog voltage samples when a digital trigger is received on PFI0. Before starting this exercise, you need to complete the exercise and use the solution in the Taking a Measurement module.

Required Hardware
1- NI ELVIS II
1- analog voltage source or transducer
Wire for connections

Things to Consider

  • Use a wire to connect PFI0 to the +5 V terminal of your NI ELVIS II device to send a trigger
  • Use the function generator to generate a sine wave and connect this to your ai0 terminals as your signal to be acquired

Here is an example of what the final signal should look like on a graph indicator:

View the exercise solution (Don’t cheat!).

Cumulative Exam:
LabVIEW and DAQ

Evaluate your understanding of LabVIEW and the basics of DAQ. This exam is recommended after you complete all of the modules for LabVIEW Basic Concepts and LabVIEW Basic Tasks. There are 26 multiple choice questions on the exam.

Take the exam


Cumulative Project:
LabVIEW and DAQ

Assess your working knowledge of building a complete system by acquiring, processing, and displaying data with LabVIEW and a DAQ device. This project is recommended after you complete all of the modules for LabVIEW Basic Concepts and LabVIEW Basic Tasks.

Start the project