Example Code

Continuous Analog Acquisition That Logs Data After Receiving Digital Pulse

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.


  • Data Acquisition (DAQ)


  • LabVIEW


  • NI DAQmx

Code and Documents



This VI sends a digital trigger to a counter line that will trigger your VI to begin logging data from your continuous analog acquisition task. 



  1. Create one analog input task and one counter input task.
  2. Configures the sample clock for the analog input task.
  3. Begin the acquisition of the counter then the analog input.
  4. Continually reads the data until the counter sees a rising edge then the analog input data is logged to file.
  5. Clears the task, merges errors, and reports any errors that occurred.



  • LabVIEW 2012 or compatible
  • NI-DAQmx 9.5.5 or compatible


  • NI Multifunction DAQ Device with at least one counter

Steps to Implement or Execute Code

  1. Download the VI
  2. Select the following controls on the front panel
    • Physical channel of analog input
    • Counter channel
    • Sample rate
    • Maximum value
    • Minimum value
  3. Run the VI
  4. See log file for data after running VI

Additional Information or References


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

Academic Product Manager
National Intruments

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