Design Idea

Circuit and software provide accurate recalibration for baseline PIC microcontroller’s internal oscillator

A simple circuit and an assembly-language program allow you to recalibrate the internal oscillator of a PIC microcontroller.

Noureddine Benabadji, University of Sciences and Technology, Oran, Algeria; Edited by Charles H Small and Fran Granville -- EDN, 5/1/2008

All of Microchip’s baseline PIC microcontrollers have internal 4-MHz oscillators, which are useful for freeing up one or two pins for I/O use and allowing you to build minimal-component-count designs using these devices. You must calibrate the internal oscillator by reading a factory-programmed calibration setting that resides at the last address in the user-program memory and then writing that setting into the microcontroller’s oscillation-calibration register during the application software’s initialization of the device. Because the calibration value is unique to each microcontroller, problems arise for time-sensitive applications if you erase or overwrite the last address.

The circuit in Figure 1 recovers the calibration value by recalibrating against a reference clock, the 4-MHz crystal. The frequency looks for the best calibration value to ensure that the microcontroller’s internal oscillator runs within 1% accuracy at 4 MHz. You can download the microcontroller’s program and a flow chart from this compressed zip file.

The baseline PIC microcontroller, which includes the PIC10F, PIC12C508/509/510, or PIC16F505/506 series, uses its internal timer, Timer 0, to count the number of instruction cycles that execute in one period from output Q8 of a Fairchild Semiconductor CD4060 oscillator/divider to the only input, GP3, of the PIC microcontroller. The 4-MHz crystal drives the CD4060, which yields a period of 128 µsec from the output Q8.

The four LEDs display the two 4-bits nibbles of the 8-bit oscillation-calibration register’s best value. Output GP2 acts as a multiplexing line to drive these LEDs for 8 to 10 sec and then as the oscillator output to yield a 1-MHz signal, which you can measure with a frequency meter or an oscilloscope.



ADVERTISEMENT

ADVERTISEMENT

Feedback Loop


Post a CommentPost a Comment

There are no comments posted for this article.

Related Content

 

By This Author

There are no additional articles written by this author.


ADVERTISEMENT

Knowledge Center


Events

COMS2008 – Commercialization of Micro and Nano Systems
Dates: 8/31/2008 - 9/4/2008
Location: Puerto Vallarta, Mexico

DISKCON USA 2008
Dates: 9/17/2008 - 9/18/2008
Location: Santa Clara, CA

China SMT Forum
Dates: 11/4/2008 - 11/6/2008
Location: Shanghai International Exhibition Center

The 6th International System-on-Chip (SoC) Conference, Exhibit & Workshops
Dates: 11/5/2008 - 11/7/2008
Location: Newport Beach, CA

Submit an EventSubmit an Event




Technology Quick Links

EDN Marketplace


©1997-2008 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