Example Code

Generate a Continuous Digital Pulse Train With a Variable Frequency

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


The example demonstrates the generation of a continuous pulse train that could be configured in its frequency parameter of it

This example is a slight modification of the "Gen Dig Pulse Train-Continuous.vi" example available in the LabVIEW Example Finder. In this version, the front panel control for frequency will be polled every loop iteration and the pulse train will be modified to reflect the new frequencies. This example employes a local variable in order to both set the initial frequency as well as to continuously update the output each loop iteration.

Steps to implement or execute code
To implement this example:
  1. Set the physical channel of the counter
  2. (Optional) Define the rest of the parameters as needed
  3. Run the VI
  4. (Optional) Turn on the Highlight Execution to see the flow of the VI


To execute this example:

  1. Install the required software.
  2. Connect the DAQ hardware that supports the Counter features
  3. Confirm the connection with the MAX with TestPanel
  4. Open the VI and refer the Implement Steps

LabVIEW 2012 or compatible
NI-DAQmx 16.0 or compatible

cDAQ with C series Counter Output Module






**This document has been updated to meet the current required format for the NI Code Exchange.**
Asa Kirby
CompactRIO Product Marketing Manager
Sail Fast!

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