Example Code

Digital Pulse Train with Frequency Update using Event Structure

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 is to demonstrate how to insert the frequency parameters while the VI is already running

Using the event structure, the VI would work to generate a pulse train signal with a pre defined frequency and would change the output's frequency as soon as the user change the parameters while the VI is running

Steps to Implement or Execute Code:

To implement this example:

  1. Define the Output Physical Channel
  2. Set the value 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.**

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

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


I implemented this VI with a SensorDAQ interface. One problem is that the SensorDAQ does not support on-the-fly frequency changes, so that I have to stop the task, change the frequency and restart the task--not terribly serious for my application. More serious is the fact that the actual frequencies I get are all integral fractions of the interface's maximum frequency. That means I get either 366.2109 Hz or 183.1055 with nothing in between. Is there any way to get arbitrary frequencies (say, 200 Hz 250 Hz)