Zibb

Design Idea

Programmed reference oscillator generates nonstandard clock frequencies

Small assembly-language process exploits equalized, fixed-length branch loops with only 12 instructions.

William Grill, Honeywell BRGA, Lenexa, KS; Edited by Brad Thompson and Fran Granville -- EDN, 4/27/2006

Although manufacturers offer crystal and ceramic resonators and packaged oscillators for many frequencies, nonstandard frequencies may not be readily available. When a unique integrator application required a 2021-Hz fixed-frequency clock, the circuit in Figure 1 solved the problem and required only a few extra and inexpensive components. The heart of the oscillator comprises a small assembly-language process that exploits equalized, fixed-length branch loops with only 12 instructions. A simple Visual Basic program provides a user-input window that calculates the number of loops necessary to create the desired frequency and also determines the required number of individual instruction periods needed to "top off" the duration of the output period (Figure 2).

Including Microchip's (www.microchip.com) PIC12F508 8-bit microcontroller, IC1, the circuit in Figure 1 uses only four components. The microcontroller operates at clock-crystal frequencies as high as 4 MHz and includes a configuration option that uses the IC's internal 4-MHz oscillator, which is accurate to ±1% as the controller's base frequency. Another version of the microcontroller, the PIC16F505, can operate at clock-crystal frequencies as high as 20 MHz.

To calculate the constants to program the microcontroller for the desired output frequency, you use the Visual Basic program, editing the clock frequency of 4 MHz in this example if necessary. Next, you enter the clock's frequency error in percentage points or parts per million and the desired output frequency in hertz. When you click on the "Evaluate" control, the program computes the high- and low-state coefficients, the number of appended instructions, and the output's duty cycle. The program also calculates the maximum initial percentage error of the output frequency. The controller's instruction-execution times and clock frequency impose constraints on the desired output frequency, duty cycle, and frequency error. For the 2021-Hz clock in this application and a 4-MHz clock frequency, the program calculates the coefficients and number of discrete instructions as 20, 21, and three, respectively. Before compiling the code and writing the results to the microcontroller's internal flash memory, you transcribe the coefficients into the microcontroller's assembly-language program.

The controller's assembly-language listing uses only 40 instructions, and its implementation leaves three of the controller's pins unused but available for a user-defined enable input or for selecting one of several preset output frequencies or coefficients. You can reduce the pc-board area the basic design uses if you select a microcontroller that occupies a smaller package, such as six-lead SOT-23 versions of the PIC10F200 or PIC10F220, and use its internal 4-MHz clock oscillator instead of an external crystal.



Reed Business Information Resource Center

Featured Company


Related Resources

ADVERTISEMENT

ADVERTISEMENT

Feedback Loop


Post a CommentPost a Comment

There are no comments posted for this article.

Related Content

 

By This Author


ADVERTISEMENT

Knowledge Center



Technology Quick Links

EDN Marketplace


©1997-2009 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other Reed Business sites