# Microcontroller-Based Circuit Measures Crystal Tolerance

May 17, 1999
Frequency tolerance is one of the most important parameters of a crystal. Determining the tolerance by measuring the crystal frequency directly isn’t always convenient, particularly for...

Frequency tolerance is one of the most important parameters of a crystal. Determining the tolerance by measuring the crystal frequency directly isn’t always convenient, particularly for large-volume sorting jobs. The circuit shown here employs Microchip’s low-end microcontroller (PIC16C54) to measure the tolerance and sort the crystals into different ppm ranges using 12 LED indicators (see the figure). The measured result (in ppm) is independent to the crystal frequency. The useful frequency range falls between 1 MHz and 20 MHz.

A standard frequency signal is used to provide the PIC16C54’s clock. The delay loop in the program executes in exactly 800,000 instruction cycles. An 8-bit counter (TMR0) in the PIC16C54 is reset at the beginning of this loop and the content of the counter is read at the end of the loop.

Because the counter is driven by a measured (UUT) crystal signal through a divide-by-8 prescaler, the counter’s content will reflect the error between the standard signal and measured signal. For instance, the counter will count 400,000 if the measured signal has the same frequency as the standard signal. The decimal number 400,000 equals to 61A80H in hexadecimal. Since the counter contains only eight bits, the higher three digits (61A) will be omitted. Thus, the measured crystal has no frequency error if the counter reading is 80H.

If the measured crystal has +10 ppm error, the counter reading will be 84H, since it will add four (400,000 × 10 ppm = 4) more pulses. The other tolerance ranges can be figured using the same method. Note that the measured crystal should have the same rated frequency as the standard frequency signal. Otherwise, a false reading may result because the maximum measurable tolerance is 320 ppm.

See associated listing