Example Code

DAQmx Retriggerable Finite Acquisition

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


Download All


This program leverages the retrigger ability of counters to overcome the fact that start triggers for analog/digital acquisitions are not retriggerable. 


The attached VI conducts 'retriggered' finite acquisitions on an analog signal.  It does this by creating a retriggerable finite pulse train and using this finite pulse train as the sample clock for a continuous acquisition. Every time the trigger fires, a finite pulse train is generated which acts as the sample clock for the continuously acquiring analog input task.  The analog input task therefore only returns samples according to the finite pulse train generated.

The trigger for this example can be any TTL signal: on-demand pulse or hardware timed pulse train.



  • LabVIEW 8.6 or compatible
  • DAQmx 8.7.2 or compatible


  • NI DAQ device with Analog Input and Counter/Timer

Steps to Implement or Execute Code

  1. Select your device and analog input channel in the Channel Being Read on the front panel
  2. Select your "Retriggerable Counter" for the sample clock output
  3. Select the PFI line corresponding to the Retriggerable Counter
  4. Select the Trigger Source
  5. Specify your Finite Acquisition Parameters (Frequency & Samples Per Trigger) as desired
  6. Run the VI

Additional Information or References

VI Snippet


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

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

NI Employee

thanks for posting! could you rename your attachment to include the LabVIEW version? "_lvXX.vi" would be fine.

Todd S.
LabVIEW Community Manager
National Instruments

Hi ,

   How can I modify this VI to generate pulses using the counter in time units? I want to leave it high for 3 s and low for 5 seconds and trigger the data acquisition every high time ?

Active Participant
Active Participant

On the first functional block (DAQmx Create Virtual Channel) you should be able to select CO Pulse Time from the drop down.  From this you should now have access to the low and high time inputs to the Counter Output VI where you can select how long you will stay low and how long you will stay high.

PS if this does not work - try calling NI Support @ 866-275-6964.


Thank you so much.