Example Code

Measure the Frequency of an Analog Signal using a Counter (C# .NET)

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.

    Software

  • Other

Code and Documents

Attachment

Overview
To measure the frequency of an analog signal in hardware.

Description:
An analog signal can be acquired and analyzed in software to determine its frequency. However, in many situations it is desirable to measure the frequency of an analog signal in hardware. A counter cannot be used to directly measure the frequency of an analog signal. Using an analog comparison event, you can generate a digital trigger that can measure the frequency and period of an analog signal using a counter. This should work with any multifunction DAQ card that has an analog input and 2 counters or more.
This example is written in C# .NET 3.5. This example builds on the ContAcqVoltageSamples_IntClk and the MeasDigFreqBuffCont_LargeRange2Ctr shipping examples. See those examples for additional information.

Additional information:

 

Measuring the Frequency of an Analog Signal in Hardware

 

Analog Input Period Counts Using Analog Comparison Event

 

ContAcqVoltage_MeasDigFreqBuffContFromAnalogTrigger.png

 

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

National Instruments

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