TExcelTAD
Home › Electrical & Electronic Measurements › Signal Sources and Frequency Counters

Signal Sources and Frequency Counters

Most measurements need a stimulus: a sine to measure a filter, a pulse to test a trigger, a modulated carrier to test a receiver. And frequency, the quantity electronics can measure most accurately of all, needs a counter and a good timebase. This lesson looks inside the modern function and arbitrary waveform generator (direct digital synthesis), and inside the frequency counter, with the error terms of each. The front-panel basics of the generator and its 50 Ω50\ \Omega output are in EE Foundations.

Direct digital synthesis

tuning word M phase accumulator N bits, + M per clock P bits sine table 2^P entries DAC D bits low-pass reconstruction fout clock fclk phase ramp

A DDS generator holds an NN-bit phase accumulator clocked at fclkf_\text{clk}. Each clock it adds a tuning word MM; the top PP bits of the phase address a sine table, and a DAC plus a reconstruction filter turn the codes into a voltage:

fout=M fclk2N,Δf=fclk2Nf_\text{out} = \frac{M\,f_\text{clk}}{2^N}, \qquad \Delta f = \frac{f_\text{clk}}{2^N}

With N=32N = 32 bits and fclk=125 MHzf_\text{clk} = 125\ \text{MHz}, the resolution is 29 mHz29\ \text{mHz} at any output frequency, and frequency changes are phase-continuous. The output is a sampled signal, so it has images at fclk±foutf_\text{clk} \pm f_\text{out}, 2fclk±fout2f_\text{clk} \pm f_\text{out}, …, the same spectrum as any sampler (Data Acquisition). The reconstruction filter removes them; that is why a DDS generator's sine output is limited to roughly 0.4fclk0.4 f_\text{clk}. Spurs come from truncating the phase to PP bits and from DAC non-linearity; datasheets give them as SFDR (spurious-free dynamic range) in dBc, alongside harmonic distortion, amplitude flatness and phase noise or jitter.

Square and pulse outputs often come from a comparator or a separate pulse generator, with specified rise time (a few ns), jitter and duty-cycle accuracy. Arbitrary waveform generators (AWGs) play a user-defined sample memory instead of the sine table, either by DDS (variable frequency, fixed memory) or "true arb" (each sample played once per period at a variable clock).

Simulation. A DDS output is a sampled sine. With f=12 Hzf = 12\ \text{Hz} and fs=50 Hzf_s = 50\ \text{Hz} (a scaled-down clock), the lab's line spectrum shows the wanted line at 12 Hz12\ \text{Hz} and images at 3838, 6262 and 88 Hz88\ \text{Hz}: all of them are present at the DAC output. A reconstruction filter must pass 12 Hz12\ \text{Hz} and remove 38 Hz38\ \text{Hz}. (The lab's own filter is an anti-alias filter in front of the sampler, so leave it off here.) Move ff to 22 Hz22\ \text{Hz}: the first image comes down to 28 Hz28\ \text{Hz}, too close for any practical filter, which is why DDS sine outputs stop near 0.4fclk0.4 f_\text{clk}.

-A0+A0.0 s0.2 s0.4 s0.6 s0.8 s1.0 sx (V)input 12.0 Hzreconstructed 12.00 Hzsamples, fs = 50.0 Hz0A0102030405060708090100f (Hz)fs/2fno aliasing: f < fs/2 = 25.00 Hz
python · try it yourself
import numpy as np

# Direct digital synthesis: 32-bit phase accumulator, 125 MHz clock, 12-bit phase to amplitude (truncated)
f_clk, N_acc, P = 125e6, 32, 12
df = f_clk / 2**N_acc
f_target = 1.234567e6
M = round(f_target / df)                          # tuning word
print(f"resolution {1e3 * df:.2f} mHz, tuning word {M}, output {M * df:.4f} Hz")

n = np.arange(2**16, dtype=np.int64)          # int64: the product M*n exceeds 32 bits
phase = (M * n) % 2**N_acc                        # exact integer phase accumulator
idx = phase >> (N_acc - P)                        # keep the top 12 bits for the sine table
y = np.round(2047 * np.sin(2 * np.pi * idx / 2**P))   # 12-bit DAC codes
Y = np.abs(np.fft.rfft(y * np.hanning(len(y))))
Y_db = 20 * np.log10(Y / Y.max())
f = np.fft.rfftfreq(len(y), 1 / f_clk)
k0 = np.argmax(Y)
mask = np.abs(np.arange(len(Y)) - k0) > 8         # everything except the carrier and its window skirt
print(f"carrier at {f[k0] / 1e6:.4f} MHz, largest spur {Y_db[mask].max():.1f} dBc at {f[mask][np.argmax(Y_db[mask])] / 1e6:.3f} MHz")
print(f"first image of the DAC output at f_clk - f = {(f_clk - M * df) / 1e6:.3f} MHz (removed by the reconstruction filter)")
resolution 29.10 mHz, tuning word 42419399, output 1234566.9966 Hz
carrier at 1.2341 MHz, largest spur -68.4 dBc at 1.251 MHz
first image of the DAC output at f_clk - f = 123.765 MHz (removed by the reconstruction filter)

The largest spur of this ideal 12-bit design sits about 68 dB68\ \text{dB} below the carrier, close to the rule of thumb of −6 dB-6\ \text{dB} per bit of phase kept (−72 dBc-72\ \text{dBc} for 12 bits).

Frequency counters

A direct counter opens a gate for TgateT_\text{gate} (derived from its timebase) and counts input cycles. Because the gate is not synchronised to the input, the count is uncertain by ±1\pm 1:

Δff∣direct=±1f Tgate\frac{\Delta f}{f}\bigg\rvert_\text{direct} = \pm\frac{1}{f\,T_\text{gate}}

which is terrible at low frequencies: ±0.1 Hz\pm 0.1\ \text{Hz} on a 10 Hz10\ \text{Hz} signal with a 1 s1\ \text{s} gate. A reciprocal counter instead synchronises the gate to input edges, counts an exact number of input cycles nn and measures their total duration with a fast clock (or interpolators). Its resolution is set by the time resolution trest_\text{res}, independent of the input frequency:

Δff∣reciprocal≈tresTgate\frac{\Delta f}{f}\bigg\rvert_\text{reciprocal} \approx \frac{t_\text{res}}{T_\text{gate}}

Modern counters are reciprocal, resolve tens of picoseconds and quote "digits per second" (e.g. 12 digits/s).

Error terms of a frequency measurement:

  • Timebase error: the counter's reference oscillator offset since calibration, ageing (ppm per year for a TCXO, parts in 10910^{9} to 101010^{10} per day for an OCXO), temperature drift. A relative timebase error is a relative frequency error, whatever the gate time.
  • Resolution: as above.
  • Trigger error: noise on a slowly slewing edge moves the trigger instant by Δt≈vn/(dv/dt)\Delta t \approx v_n / (dv/dt); it matters most for low-frequency sines and short gates.

A GPS-disciplined oscillator or a lab's 10 MHz10\ \text{MHz} distribution feeding the counter's external reference input removes the timebase term almost entirely; it is how traceability to the SI second reaches a bench (Calibration).

Worked example: a 10 MHz oscillator on a TCXO counter

Given: a reciprocal counter with 10 ns10\ \text{ns} resolution, 1 s1\ \text{s} gate, TCXO timebase: within ±0.5 ppm\pm 0.5\ \text{ppm} after calibration, ageing ±1 ppm\pm 1\ \text{ppm} per year (one year since calibration), temperature ±1 ppm\pm 1\ \text{ppm}; trigger error 1 ns1\ \text{ns} per edge.

Find: the resolution and the uncertainty of a 10 MHz10\ \text{MHz} reading.

Solve: resolution 10 ns/1 s=10−810\ \text{ns}/1\ \text{s} = 10^{-8}, i.e. 0.1 Hz0.1\ \text{Hz}. The timebase limits sum to 2.5 ppm=25 Hz2.5\ \text{ppm} = 25\ \text{Hz}; as independent limits, their root-sum-square is

0.52+12+12+0.012+(2×0.001)2 ppm=1.50 ppm=15 Hz\sqrt{0.5^2 + 1^2 + 1^2 + 0.01^2 + (\sqrt{2} \times 0.001)^2}\ \text{ppm} = 1.50\ \text{ppm} = 15\ \text{Hz}

Check: the display shows 0.1 Hz0.1\ \text{Hz} steps, but the reading is uncertain by about 15 Hz15\ \text{Hz}: some 150 times the resolution. Only an external reference makes the extra digits meaningful.

python · try it yourself
# Frequency counter resolution for a 1 s gate: direct counting vs reciprocal counting
f_clk = 100e6                       # reciprocal counter's time-interval clock (10 ns resolution)
T_gate = 1.0
print(f"{'f':>8s} {'direct: +/-1 count':>20s} {'reciprocal':>12s}")
for f, label in ((10.0, "10 Hz"), (1e3, "1 kHz"), (1e6, "1 MHz"), (100e6, "100 MHz")):
    direct = 1 / (f * T_gate)                     # one count in f*T_gate
    recip = (1 / f_clk) / T_gate                  # one clock period in the measured interval
    print(f"{label:>8s} {direct:20.1e} {recip:12.1e}")

# Error budget of a 10 MHz measurement with a TCXO timebase, 1 s gate, reciprocal counter
f = 10e6
tb_cal = 0.5e-6          # timebase offset limit since calibration (relative)
tb_aging = 1e-6          # aging per year (relative), one year since calibration
tb_temp = 1e-6           # temperature limit over the room range (relative)
res = 1e-8               # resolution, from the table
trig = 1e-9              # trigger error: 1 ns noise-induced timing error per edge on a 1 s gate
total = (tb_cal**2 + tb_aging**2 + tb_temp**2 + res**2 + (2**0.5 * trig)**2) ** 0.5
print(f"10 MHz reading: timebase limits summed {(tb_cal + tb_aging + tb_temp) * f:.1f} Hz, "
      f"root-sum-square of the limits {total * f:.1f} Hz ({total * 1e6:.2f} ppm)")
       f   direct: +/-1 count   reciprocal
   10 Hz              1.0e-01      1.0e-08
   1 kHz              1.0e-03      1.0e-08
   1 MHz              1.0e-06      1.0e-08
 100 MHz              1.0e-08      1.0e-08
10 MHz reading: timebase limits summed 25.0 Hz, root-sum-square of the limits 15.0 Hz (1.50 ppm)

Guided lab: generator against counter

Hand calculation. A generator with a ±1 ppm\pm 1\ \text{ppm} timebase set to 1.000000 MHz1.000000\ \text{MHz} should read within ±1 Hz\pm 1\ \text{Hz} plus the counter's own timebase error.

Simulation. Change f_target and N_acc in the DDS program and see the resolution and actual frequency; change the gate time in the counter program.

What you would measure. Set a generator to 1 MHz1\ \text{MHz}, 1 Vpp1\ \text{V}_\text{pp} sine, and read it with a counter (or a scope's frequency counter function) at 0.10.1, 11 and 10 s10\ \text{s} gates. Expect a fixed offset of a few hertz (the two timebases disagree) and scatter that shrinks with gate time. If both instruments have a 10 MHz10\ \text{MHz} reference connector, link the generator's reference output to the counter's input: the offset should collapse to the resolution. Then measure a 10 Hz10\ \text{Hz} sine of small amplitude: the reading scatters more, because the slow edge makes the trigger error large; a square wave or more amplitude fixes it.

Hazards and safe setup. Signal levels only; terminate 50 Ω50\ \Omega outputs properly.

Pitfalls

  • Treating displayed digits as accuracy: the timebase decides.
  • Measuring low frequencies with a direct-counting instrument and a short gate.
  • Ignoring DDS images and spurs when testing a wideband or mixing circuit (they are real signals at the output).
  • Using a sine with a slow edge and noise at a counter input: trigger error.

Practice

  1. A 28-bit DDS runs at 50 MHz50\ \text{MHz}. What is its frequency resolution, and what tuning word gives 1 kHz1\ \text{kHz}?
  2. A direct counter with a 0.1 s0.1\ \text{s} gate reads a 50 Hz50\ \text{Hz} signal. What is its resolution?
Answer
  1. Δf=50 MHz/228=0.186 Hz\Delta f = 50\ \text{MHz}/2^{28} = 0.186\ \text{Hz}; M=1000/0.186=5369M = 1000/0.186 = 5369 (giving 1000.05 Hz1000.05\ \text{Hz}).
  2. ±1\pm 1 count in 5 counts: ±10 Hz\pm 10\ \text{Hz} (20 %). Use a reciprocal counter or a period measurement.

Test yourself

The frequency resolution of a DDS is

  1. fclk/2Nf_\text{clk}/2^N
  2. fclk/2f_\text{clk}/2
  3. the DAC's LSB
  4. 1/fclk1/f_\text{clk}

Why does a DDS output need a reconstruction filter?

  1. to remove the DC offset
  2. to remove images at fclk±foutf_\text{clk} \pm f_\text{out}
  3. to increase the amplitude
  4. to reduce jitter only

A reciprocal counter's resolution depends mainly on

  1. the input frequency
  2. its time resolution and the gate time
  3. the input amplitude
  4. the display

The dominant uncertainty of a frequency reading on a counter with an internal TCXO is usually

  1. the one-count resolution
  2. the timebase error
  3. the trigger level
  4. the display rounding