Example Code

Single Counter Pulse on Analog Edge Trigger with Continuous Acquisition Using LabVIEW

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 example VI continuously acquires an analog voltage and generates a single counter pulse output when an analog comparison event occurs.

 

Description
In this example the same analog input line is used for the physical channel of the AI Voltage Task and the trigger source of the Analog Edge Start Trigger.  Due to the location of the Analog Trigger Detection on M-series DAQ cards this method does not work when there are multiple analog input channels.  To bypass this, use an APFI line for the analog trigger source which duplicates the analog input signal.

Also, the counter pulse is retriggerable so that it will occur on the edge of every analog comparison event.  However, to begin the analog acquisition at the start it is necessary to first trigger the analog comparison event.


Requirements

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


Steps to Implement or Execute Code

  1. Select the physical channel to correspond to where your signal is input on the DAQ device.
  2. Enter the minimum and maximum voltage range.
  3. Set the number of samples to acquire per channel.
  4. Set the rate of the acquisition

 

Additional Information or References

VI Snippet

3-203.png

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

Barron
Applications Engineering
National Instruments

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

Comments
christophe.A
Member
Member
on

Unfortunately, it triggers on rising and falling edges of analog comparison event (even if you specify the polarity on DAQmx Start Trigger Digital)... How would you do to bypass this and be able to choose either rising or falling edges?

Thanks

Chris