Sunteți pe pagina 1din 3

3/12/2017 Frequency Measurements: How-To Guide - National Instruments

Frequency Measurements: How-To Guide


Publish Date: May 06, 2016

Overview
This document is part of the How-To Guide for Most Common Measurements (http://zone.ni.com/devzone/cda/tut/p/id/7136)
centralized resource portal.

Table of Contents
1. Frequency Overview
2. How to Make a Frequency Measurement
3. Recommended Hardware and Software
4. Frequency Webcasts Tutorials, and Other How-To Resources

1. Frequency Overview

Frequency is the rate of recurrence of a cyclic or periodic event. In phy


sics, you can observe periodicity in rotations, oscillations, and waves.
For an analog or digital waveform, you can invert the signal period to o
btain the frequency. The smaller the period, the higher the frequency a
nd vice versa. This is illustrated in Figure 1, with the top waveform havi
ng the lowest frequency and the bottom waveform having the highest fr
equency.

Figure 1. Waveforms with Frequency Increasing from Top to Bottom


Frequency is usually represented as angular frequency ω in radians/second, or as ƒ in seconds-1, also known as the unit hertz
(Hz). You also can use beats per minute (BPM) and revolutions per minute (RPM) to represent frequency. Angular frequency ω
(rad/sec) and ƒ (Hz) are related by the following formula: ω =2πƒ. Frequency is also spoken of in correlation to a phase φ,
which describes an offset of the wave from a specified reference point at the initial time t0, and is usually given in degrees or
radians. Taking the example of a sinusoidal wave, the waveform function is expressed in terms of time as , with
amplitude A, angular frequency ω, and phase φ as constants.
Periodic analog signals in real applications are complex and can rarely be represented by a simple sinusoid. Fourier analysis is
used to decompose any complex waveform into a sum of simpler functions, either sines and cosines or complex exponentials.
The frequency components that make up such a signal are often the properties of interest, and this analysis is known as
frequency-domain or spectral analysis. This type of analysis is required mainly for sound and vibration and is not examined in
this white paper.
Obtaining the frequency of a digital signal, on the other hand, is quite simple. For a simple digital signal, such as the one
depicted in Figure 2, the period is simply the time between rising edges, or even falling edges.

Figure 2. Digital Waveform


If the time between rising or falling edges varies slightly, you can average it over a large number of samples to determine the
frequency.
2. How to Make a Frequency Measurement
For a digital frequency acquisition, the process is fairly simple. For low-frequency signals, it is sufficient to use one counter, or
timebase. The rising edge of the input signal triggers the number of timebase ticks to be counted. Because the timebase is of a
known frequency, you can easily calculate the frequency of the input signal (see Figure 3).

Figure 3. Digital Signal with Respect to Internal Timebase (One Counter for Low Frequency)
When the frequency of the digital signal is very high or varies, it is better to use one of the two-counter methods described
below. Note that the same hardware limitation applies to both two-counter methods. That is, the frequency you are measuring
cannot exceed the maximum input frequency supported by the counter, even though it may exceed that of the internal
timebase.
High-Frequency Two-Counter Measurement Method

http://www.ni.com/tutorial/7111/en/ 1/3
3/12/2017 Frequency Measurements: How-To Guide - National Instruments
For a high-frequency signal, you need two counters. A paired counter (two counters) generates a pulse train with a user-
specified period, “measurement time” (see Figure 4), much larger than that of the signal you are measuring but small enough to
prevent counter rollover.

Figure 4. Digital Signal Frequency Measured with Two Counters (High Frequency)
The measurement time of this Internal Signal should be a multiple of the Internal Timebase, or, in other words, divided down.
The number of ticks of the Input Signal is then counted over the known period of time provided by theInternal Signal. Dividing
the number of ticks by the known measurement time gives the frequency of the Input Signal.
Large-Range Two-Counter Measurement Method
For signals with variations in frequency, this two-counter method provides increased accuracy throughout the entire range. The
Input Signal in this case is divided by a known value, or divisor. The number of ticks of the Internal Timebase is counted over
one logic-high of the Divided Down Signal (see Figure 5). This gives the time of the logic-high, which is the product of the
number of ticks counted and the period of the Internal Timebase. This in turn can be multiplied by 2 to get the period for the
Divided Down Signal (high and low time), which is a multiple of the Input Signal period. The Input Signal’s period can then be
inverted to obtain its frequency.

Figure 5. Digital Signal Frequency Measured with Two Counters (Large Range)
This method is like averaging the values over a longer range to account for the variation in the signal, but you can also use this
method to measure signals with higher frequencies than the timebase.
Connecting Your Digital Signal to an Instrument to Count Frequency
Many devices with hardware timing may be appropriate for counter measurements. Consider an NI CompactDAQ system as an
example (see Figure 6). The hardware timebase for NI CompactDAQ is located on the backplane of the chassis and is not
specific to the NI C Series modules themselves.

Figure 6. NI cDAQ-9178 Chassis and NI 9401 Digital I/O Module


The NI 9401 has a D-Sub connector that provides connections for the eight digital channels. Each channel has a digital I/O pin
to which you can connect a digital input or output device. Access to the four counters of the CompactDAQ chassis is available
any of the slots of the chassis; if using the cDAQ-9172, access to its two counters is only available through slots 5 and 6,
therefore insert the 9401 in slot 5.After setting up the frequency acquisition as a counter task in Measurement & Automation
Explorer (MAX), the PFI input terminal to which you should connect your signal is indicated (see Figure 7).

Figure 7. Screenshot of Configuration in Measurement & Automation Explorer (MAX)


Getting to See Your Measurements: NI LabVIEW
Once you have configured the system, you can view the data using the LabVIEW graphical programming environment (see
Figure 8).

http://www.ni.com/tutorial/7111/en/ 2/3
3/12/2017 Frequency Measurements: How-To Guide - National Instruments

Figure 8. Frequency Measurement as Seen in LabVIEW


3. Recommended Hardware and Software
Example Frequency Measurement System (http://ohm.ni.com/advisors/jsp/common/load/load.jsp?id=CD4264631)
NI CompactDAQ: 3-minute “out of the box” video (https://lumen.ni.com/nicif/us/democdaq/content.xhtml)
Take a Virtual Tour of NI CompactDAQ (https://lumen.ni.com/nicif/us/democdaqtour/content.xhtml)
Learn about and test-drive LabVIEW software for free (http://www.ni.com/labview/whatis/)
4. Frequency Webcasts Tutorials, and Other How-To Resources
Making Accurate Frequency Measurements (http://zone.ni.com/devzone/cda/tut/p/id/3619)
How to Use an NI Multimeter (http://zone.ni.com/devzone/cda/tut/p/id/3457#toc4)
Learn About Relevant Training Options: Data Acquisition and Signal Conditioning
(http://sine.ni.com/tacs/app/overview/p/ap/of/id/1578/)

http://www.ni.com/tutorial/7111/en/ 3/3

S-ar putea să vă placă și