CERAMIC RESONATOR
Context
● You are developing an embedded application using one or more members of the 8051 family of microcontrollers.
● You are designing an appropriate hardware foundation for your application.
Problem
When and how should you use a ceramic resonator with members of the 8051–family microcontrollers?
Background
A ceramic resonator is, like a quartz oscillator, based on a piezoelectric material. In this case, the material is (as the name suggests) a form of piezoelectric ceramic.
See CR YST AL OSCILLA TOR [page 54] for additional background material.
Solution
The aim of this pattern is to help you decide if you should use a ceramic resonator with your 8051 microcontroller and, if so, how to connect such a device. This section directly addresses these issues.
Stability issues
As discussed in CR YST AL OSCILLA TOR [page 54], a key factor in selecting an oscillator for your system is the issue of oscillator stability. Unlike crystal oscillators, which usu- ally have stability measured expressed in parts per million, ceramic resonator stability is usually stated in percentage terms. A figure of 1% stability is common. There are 1,440 minutes in a day and a clock based on a 1% ceramic resonator could expect to gain (or lose) around 14 minutes every day. Clearly, such devices are not suitable for operations requiring accurate timing over a long period. Note, however, that if we require the resonator to form the basis of a 30-second delay, the likely gain or loss is
0.3 seconds: this may not be a problem.
Cost issues
Ceramic resonators cost half the price of a crystal oscillator.
External capacitors
Most ceramic resonators include internal capacitors. They may therefore be directly accessed to the microcontroller without the need for external capacitors. This makes them easy to use and can further reduce costs and the required board size.
Hardware resource implications
Use of a ceramic resonator has no direct implications for the memory requirements in your application.
Note also that the performance of your application is directly related to the res- onator frequency. If your application cannot perform sufficiently rapidly, consider increasing this frequency. Alternatively, consider using a more modern 8051 design, from Dallas or Infineon (for example) that requires fewer clock cycles to carry out each instruction.
Reliability and safety implications
See CR YST AL OSCILLA TOR [page 54] for a general discussion of reliability and safety issues associated with oscillators.
Overall, the ceramic resonator is the most physically robust form of oscillator we consider.
Portability
These techniques can be, and are, used with a wide range of microcontrollers and microprocessors.
Please note that ceramic resonators should not, generally, be used as plug-in replacements for crystal oscillators: different capacitors (if any) are required for each solution.
Overall strengths and weaknesses
Cheaper than crystal oscillators.
Physically robust: less easily damage by physical vibration (or dropped equipment etc.) than crystal oscillator.
Many resonators contain in-built capacitors and can be used without any external components.
Small size. About half the size of crystal oscillator.
Comparatively low stability: not general appropriate for use where accurate timing (over an extended period) is required. Typically ±5000 ppm = ±2500 min per year (up to ~50 minutes / week).
Related patterns and alternative solutions
CR YST AL OSCILLA TOR [page 54] describes the main alternative.
Example: Connecting a ceramic resonator to an 8051 microcontroller Many simple consumer applications, where accurate timing is not required and cost is an issue, make use of ceramic resonators. In most cases, resonators with internal capacitors are used: the same resonator can be used with any member of the 8051 family (Figure 4.7).
capacitors have two pins (like crystals); those with capacitors have a third pin. Where there are three pins, the middle pin should