Example Code

Synchronizing the Frequency of Two Counters Using a Third Counter

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 a method of synchronizing the frequency of two counters by utilizing a third counter.

Description:
While it is relatively simple to align the rising edges of two counters by using a start trigger, it can become more complicated when a user wants to change the frequency or duty cycles of the counters on the fly.  

One way to accomplish this is to use a third counter as the source of ticks for the two counters, and then change the number of high ticks and low ticks of the two counters separately in order to change their duty cycles. This example allows two counters to generate a continuous pulse train, where the rising edges and frequency are aligned, but the duty cycle of the two pulses can differ and be changed on the fly.

Requirements:

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


Instructions:

  1. Specify all control values on the front panel. For more information, click on Help >> Show Context Help and hover your pointer to the controls.
  2. Run this VI.

2017-10-29_14-27-13.jpg2017-10-29_14-27-34.jpg

**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.