See: http://www.dvanhorn.org/Micros/All/Index.php Dave VanHorn's awsome Oscillator FAQ.
G. Shearer of the Free Electron Laser Research Center at Vanderbilt University Nashville, Tennessee says:
There are several basic methods to provide a clock for the microcontroller. The microcontroller has an internal oscillator and two pins are provided on the 16F84 ( pins 15 & 16 ) to connect the frequency standard for the clock. 16F84 microcontrollers are available in either DC 4 MHz and DC 10 MHz versions. The chip number has either a /04 or /10 suffix. The 16F84A version is capable of operation from DC to 20 MHz, however this version is not readily available at this time.
The cost difference between the units is small and with small quantities, it would probably be better to buy the highest clock frequency version that is available. For large quantities, it would be prudent to select the lowest clock frequency that comfortably meets the application requirements as the cost savings increase with quantity. The frequency specifications are only the manufacturer's guarantee. I am aware of experiments of overclocking (operating the microcontroller at a higher than specified rate) microcontrollers with acceptable results. This would be good for experimentation but would not be considered good design practice
The least accurate method would be an RC ( resistor capacitor ) network connected to pin 15. The RC mode can be used when timing is not a critical concern such as when two inputs are high, the desired output goes high. The time constant of the RC network determines the frequency, wheret = R * C
andf=1 / T t = time in Seconds R = resistance in Ohms C = capacitance in Farads f = frequency in Hertz
It is recommended that if you do plan to use the RC frequency standard method, the resistor values should remain between 5 K and 100 K which would require a capacitor value of approximately 20 pF. Resistances <= 2.2k may cause the oscillator to become unstable or stop altogether. Extremely high resistances such as 1 Meg can cause the oscillator to become overly sensitive to noise, humidity and leakage.
Inexpensive resistors and capacitors do not have tolerances capable of providing an accurate clock frequency which is good enough for measuring time, transmitting or receiving serial information and other time measurement or time critical applications. Standard ¼ watt resistors commonly have a tolerance of 1% and ceramic capacitors would have a tolerance of approximately 5%. RC components having a sufficient tolerance for serial communications would be considerably more expensive than the other options available as a good frequency standard.
Quartz crystals have an extremely high tolerance, which is measured, in parts per million (PPM). Quartz crystals cost several dollars apiece, however, provide the highest accuracy. Along with the crystal, two capacitors of approximately 22 pF will be required (see the listing below). I recommend using monolithic ceramic capacitors for this job, as they are much smaller and more stable than the common ceramic disk version. Using this option can cost nearly as much as the microcontroller itself. If you were building a digital clock or capacitance meter, a quartz crystal would be the component of choice.
Microchip recommends the following capacitor values for crystal oscillators. Higher capacitance will increase the stability of the oscillator but will also increase the start-up time. The JAL target chip library will set the mode fuse properly for the selected frequency. Do, however, remember that selecting a frequency other than 4 MHz or 10 MHz will cause timing and delay problems as JAL calculates these values based on standard clock frequencies.Mode Frequency Capacitance LP 23 kHz 68 100 pF LP 200 kHz 15 33 pF XT 100 kHz 100 150 pF XT 2 MHz 15 33 pF XT 4 MHz 15 33 pF HS 4 MHz 15 33 pF HS 10 MHz 15 33 pF
The third and in my opinion the best option for general use would be a ceramic resonator. Tolerance for a ceramic resonator is approximately 0.5%, which is more than adequate for all but the most critical time measurement applications. Remember also that dividing the clock frequency also divides the tolerance at the same time. Ceramic resonators also require capacitors like quartz crystals. For all intents and purposes, the microcontroller does not know the difference between a ceramic resonator and a quartz crystal. Better yet, there are versions of ceramic resonators available, which have built in capacitors and cost only pennies more than the version without capacitors. Best of all, either version costs less than one dollar.
The following is a list of ceramic resonators that I have used in the experiments I have conducted. Note the 20 MHz resonators are for use with the 16F877 Microcontroller.Frequency Manufacturer Part Number Capacitors 4 MHz Murata Erie CSA4.00MG W/O 4 MHz Panasonic EFO-MN4004A4 W/O 4 MHz Panasonic EFO-MC4004A4 W 10 MHz Murata Erie CSA10.00MG W/O 10 MHz Panasonic EFO-MN1005B4 W/O 10 MHz Panasonic EFO-MC1005B4 W 10 MHz ECS, Inc. ZTA-10.00MT W/O 10 MHz ECS, Inc ZTT-10.00MT W 20 MHz ECS, Inc. ZTA-20.00MX011 W/O 20 MHz ECS, Inc. ZTT-20.00MT W
For ceramic resonators without capacitors, I have been successful using 22 pF for both 4 and 10 MHz resonators. Microchip recommends 15 33 pF and setting the mode fuse to XT for 4 MHz and HS for 10 MHz resonators. All of the resonators listed above are +- 0.5%.
It's a corollary to Murphy's law. "Oscillators amplify. Amplifiers oscillate."
This page will soon merge with /techref/piclist/jal/microcontrollerclockoptions.htm
|file: /Techref/microchip/osc.htm, 10KB, , updated: 2013/7/23 11:30, local time: 2019/3/22 17:35,
|©2019 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.massmind.org/techref/microchip/osc.htm"> PIC Microcontroller Clock Options</A>
|Did you find what you needed?|
Welcome to massmind.org!
Welcome to www.massmind.org!