This content requires the Adobe Flash Player and a browser with JavaScript enabled. Click here to get the latest version of Adobe Flash Player.

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

Noureddine Benabadji, University of Sciences and Technology, Oran, Algeria -- EDN Europe, 01 Jun 2008

All of Microchip’s (www.microchip.com) 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-componentcount 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 in a compressed zip file here.

The baseline PIC microcontroller, which includes the PIC10F, PIC- 12C508/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 (www.fairchildsemi.com) 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 output Q8.

The four LEDs display the two 4-bits nibbles of the 8-bit oscillationcalibration 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.


 

Our Sponsors



Ads by Google