Home > Power Circuits > What are the functions of crystal oscillator?

What are the functions of crystal oscillator?

Source: InternetPublisher:黄土马家 Keywords: Crystal oscillator electronic components electromechanical devices Updated: 2020/03/18

What is a crystal oscillator and what is its role? For power engineers, the crystal oscillator is one of the indispensable components during the research and development process. Let’s take a closer look at what exactly the crystal oscillator does?

What is a crystal oscillator?

The crystal oscillator is generally called a crystal resonator. It is an electromechanical device. It is made of quartz crystal with very small electrical loss, which is precision cut and ground, plated with electrodes and soldered with leads. The crystal oscillator is very important for the microcontroller. It can be said that without the crystal oscillator, there is no clock cycle. Without the clock cycle, the program code cannot be executed. In that case, the microcontroller cannot work. Next, follow the editor to learn in detail the circuit principle and function of the microcontroller crystal oscillator.

What are the functions of crystal oscillator?

The necessity of microcontroller crystal oscillator

When the microcontroller works, it fetches instructions from the ROM one by one and then executes them step by step. The time it takes for a microcontroller to access memory once is called a machine cycle, which is a time base. One machine cycle consists of 12 clock cycles. If a microcontroller chooses a 12MHZ crystal oscillator, its clock cycle is 1/12us, and its one machine cycle is 12x (1/12)us, which is 1US.

Among all the instructions of the MCS-51 microcontroller, some are completed relatively quickly, as long as one machine cycle is enough, some are relatively slow, requiring 2 machine cycles, and two instructions require 4 machine cycles. In order to measure the length of instruction execution time, a new concept is introduced: the instruction cycle. The so-called instruction cycle refers to the time it takes to execute an instruction. For example, when you need to calculate the time required to complete the DJNZ instruction, you must first know the frequency of the crystal oscillator. Assume that the crystal oscillator used is 12MHZ, then one machine cycle is 1US. The DJNZ instruction is a two-cycle instruction, so it costs 2US to execute once. If the instruction needs to be executed 500 times, it takes exactly 1000us, which is 1ms.

The machine cycle is not only important for instruction execution, but the machine cycle is also the time base for the microcontroller timers and counters. For example, if a microcontroller selects a 12MHZ crystal oscillator, then when the timer value is increased by 1, the actual elapsed time is 1us. This is the timing principle of the microcontroller.

Frequently Asked Questions about Microcontroller Crystal Oscillator

1. How to choose a crystal in the PIC microcontroller oscillation circuit?

For a high-reliability system design, the choice of crystal is very important, especially when designing a system with sleep and wake-up functions, low voltage is often used to achieve low power consumption. This is because the low supply voltage reduces the excitation power provided to the crystal, resulting in The crystal starts to oscillate very slowly or cannot start at all. This phenomenon is not particularly obvious during power-on reset. The reason is that there is enough disturbance in the circuit during power-on, and it is easy to establish oscillation. When waking up from sleep, the disturbance in the circuit must be It is much smaller than when it is powered on, and it becomes very difficult to start oscillation. In the oscillation circuit, the crystal cannot be over-excited, which will easily vibrate to higher harmonics, nor can it be under-excited, which will not easily start. The choice of crystal must at least Consider the resonant frequency point, load capacitance, excitation power, and long-term stability of temperature characteristics.

2. How to judge whether the crystal oscillator in the circuit is overdriven?

Resistor RS is often used to prevent the crystal oscillator from being over-driven. Over-driving the crystal oscillator will gradually cause loss and reduce the contact plating of the crystal oscillator. This will cause the frequency to rise. You can use an oscilloscope to detect the OSC and output pin. If you detect a very clear sine wave and sine wave If the upper and lower limits of the sine waveform meet the clock input requirements, the crystal oscillator is not overdriven. On the contrary, if the peaks and troughs of the sine waveform are flattened to make the waveform square, the crystal oscillator is overdriven. At this time, the crystal oscillator is overdriven. A resistor RS is needed to prevent the crystal oscillator from being overdriven. The simplest way to judge the value of the resistor RS is to connect a 5k or 10k fine-tuning resistor in series and slowly increase it from 0 until the sine wave is no longer flattened. This method can find the closest resistor RS value.

3. How to choose the capacitor in the crystal oscillator circuit?

(1) C1, C21, because each crystal oscillator has its own characteristics, it is best to select external components according to the values ​​provided by the manufacturer. (2) Within the allowable range, the lower the values ​​of C1 and C2, the better. Although a larger C value is beneficial to the stability of the oscillator, it will increase the start-up time. (3) The C2 value should be greater than the C1 value, so that the crystal oscillator can start to oscillate faster when power is turned on. The working function of the above rapid crystal oscillator.

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号