Example Code

Counter Pulse Generation and Frequency Measurement Loop-back Test

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:
Demonstrates on internally routing digital pulses generated from a Counter Output to the Counter Input and updating the digital pulse frequency on the fly.

Requirements:
  1. LabVIEW 2012 or compatible.
  2. NI-DAQmx 15.5.1 or compatible.
  3. DAQ device with at least 2 counters.

Instructions:

  1. Specify all control values on the front panel.
  2. Run this VI.
  3. Verify the pulse frequency from the indicator.


Block Diagram Steps:

  1. Creates channel to generate digital pulses.
  2. Sets the channel to be continuously sampling data.
  3. Programs the hardware as much as possible according to the task configuration.
  4. Transitions the task to running state to begin generation.
  5. Allows the user to update the pulse frequency on the fly.
  6. Clears the task and displays any error occurs.

Block Diagram Steps:

  1. Creates channel to generate digital pulses.
  2. Sets the channel to be continuously sampling data.
  3. Internally route the generated signal to the default source pin of the counter.
  4. Transitions the task to running state to begin generation.
  5. Continuously updates the frequency measurement on the front panel.
  6. Clears the task and displays any error occurs.

2017-05-31_14-33-32.jpg2017-05-31_14-33-57.jpg

**This document has been updated to meet the current required format for the NI Code Exchange.**
Sean Ferguson
Application Engineering Specialist | RF and Reconfigurable Test

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