Example Code

Software Retriggerable Analog Input with Digital Edge Trigger 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 shows how to perform a software-based retriggerable analog input acquisition using the DAQmx Control Task.vi.

 
Description

Older E and M series cards do not have built in retriggerable analog input. One workaround we can implement is to have a finite analog input task that we can then start, wait for the trigger, acquire data, and then stop and restart to wait for the next trigger. This is a costly process, but we can increase the programming efficiency by using the DAQmx task state model to our advantage. By default, the DAQmx task state model starts in the unverified stage and then moves through the verified, reserved, and committed state before going to the running state where we take our measurements. The Start Task VI will move us from the unverified state to the running state and the Stop Task VI will move us back to the unverified state.

However, by using the DAQmx Control Task VI we can get our task to the commit state, before starting the task. The task will then move back and forth between the commit and running state instead of between the unverified and the running state. This will increase the efficiency of our loop and will allow us to retrigger at a faster (albeit slower compared to hardware retriggering) rate.


Requirements

Software

  • LabVIEW 2012 (or compatible)
  • DAQmx 14.0 (or compatible)

Hardware

  • M or E series DAQ cards


Steps to Implement or Execute Code

  1. Configure the Channel Settings, Timing Settings and Trigger Settings.
  2. Run the VI.

 

Additional Information or References
VI Snippet

013.png

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

Gabriel M.
Product Marketing Engineer - Academic Courseware
National Instruments

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