Twenty-one questions about 51 single-chip microcomputer crystal oscillator

Publisher:文江桂青Latest update time:2021-03-19 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Why does the 51 microcontroller prefer to use 11.0592MHZ crystal oscillator?


First: Because it can be accurately divided into clock frequencies, related to the baud rates commonly seen in UARTs (Universal Asynchronous Receiver/Transmitter). Especially for higher baud rates (19600, 19200), these crystals are accurate no matter how odd the values ​​are, and are commonly used.


Second, the reason for using 11.0592 crystal oscillator is caused by the timer of 51 single-chip microcomputer. When using the timer of 51 single-chip microcomputer as baud rate generator, if 11.0592Mhz crystal oscillator is used, the value that needs to be set by the timer is an integer according to the formula; if 12Mhz crystal oscillator is used, the baud rate is biased, for example, 9600, the timer takes 0XFD, the actual baud rate is 10000, and the general baud rate deviation is about 4%, so STC90C516 crystal oscillator 12M baud rate 9600 can also be used. The error rate is 6.99% when it is a multiple, and 8.51% when it is not a multiple, and the data will definitely be wrong. This is why everyone likes to use 11.0592MHz crystal oscillator for serial communication. When the baud rate is doubled, it can reach up to 57600, with an error rate of 0.00%. Using 12MHz, the highest is only 4800, and there is a 0.16% error rate, but it is within the allowable range, so it doesn't have much impact.


Second, when designing the PCB of a 51 MCU system, why is the crystal oscillator required to be next to the MCU?


The reason is as follows: the crystal oscillator generates mechanical vibrations of a fixed frequency through electrical excitation, and the vibrations will generate currents to feed back to the circuit. After receiving the feedback, the circuit amplifies the signal and uses the amplified electrical signal to excite the mechanical vibrations of the crystal oscillator again. The crystal oscillator then feeds back the current generated by the vibrations to the circuit, and so on. When the excitation electrical signal in the circuit is the same as the nominal frequency of the crystal oscillator, the circuit can output a strong signal and a stable frequency sine wave. The shaping circuit then converts the sine wave into a square wave and sends it to the digital circuit for use.


The problem is that the output capacity of the crystal oscillator is limited. It only outputs electrical energy in milliwatts. Inside the IC (integrated circuit), this signal is amplified hundreds or even thousands of times by an amplifier before it can be used normally.


The crystal oscillator and IC are usually connected by a copper wire. This wire can be regarded as a section of wire or several sections of wire. When the wire cuts the magnetic lines, it will generate current. The longer the wire, the stronger the current generated. In reality, magnetic lines are not common, but electromagnetic waves are everywhere, such as: wireless broadcast transmission, TV tower transmission, mobile phone communication, etc. The connection between the crystal oscillator and the IC becomes a receiving antenna. The longer it is, the stronger the received signal is, and the stronger the electric energy generated is. Until the strength of the received electric signal exceeds or approaches the signal strength generated by the crystal oscillator, the output of the amplifier circuit in the IC will no longer be a square wave of fixed frequency, but a messy signal, causing the digital circuit to fail to work synchronously and make mistakes.


Therefore, when drawing a PCB (circuit board), the closer the crystal oscillator is to its amplifier circuit (IC pin) the better.


3. Analysis of the reasons why the crystal oscillator of the microcontroller circuit does not oscillate


It is a common phenomenon that the crystal oscillator of the microcontroller does not oscillate. What are the reasons for the crystal oscillator not oscillating?


① PCB board wiring error; ② MCU quality problem; ③ Crystal oscillator quality problem;


④The load capacitor or matching capacitor does not match the crystal oscillator or the capacitor quality is problematic; ⑤The PCB board is damp, resulting in impedance mismatch and failure to oscillate; ⑥The routing of the crystal oscillator circuit is too long;


⑦ There is a wiring between the two pins of the crystal oscillator; ⑧ The influence of the peripheral circuit.


Solution: It is recommended to troubleshoot the problems one by one as follows:


① Eliminate the possibility of circuit error, so you can use the recommended circuit of the corresponding model of microcontroller for comparison. ② Eliminate the possibility of defective peripheral components, because peripheral parts are nothing more than resistors and capacitors, it is easy to identify whether they are good products. ③ Eliminate the possibility that the crystal oscillator is a stopped oscillator, because you will not try only one or two crystal oscillators. ④ Try to change the capacitors at both ends of the crystal, maybe the crystal oscillator can start oscillating. Please refer to the instructions for use of the crystal oscillator for the size of the capacitor.


⑤ When wiring the PCB, the routing of the crystal oscillator circuit should be as short as possible and as close to the IC as possible, and avoid routing between the two pins of the crystal oscillator.


Fourth, when the 51 single-chip microcomputer clock circuit uses a 12MHZ crystal oscillator, how is the value of the capacitor obtained?


In fact, no one can explain how to choose the value of these two capacitors, because 22pF is too small. This can only be said to be related to the characteristics of the internal oscillation circuit itself, and is used together to correct the waveform. No one has studied why it is such a large value.


19.What will happen if the 89c52 microcontroller is not connected to a crystal oscillator?


The microcontroller doesn't work, the program can't be burned in...etc.


5. What happens if the two fine-tuning capacitors in the microcontroller crystal oscillator circuit are asymmetrical? How will the frequency change if the difference is too large? When testing the receiving module of the wireless mouse, it is found that its frequency always changes slowly (that is, if you keep your hand on the probe, you will find that the frequency gradually decreases). The crystal oscillator is new!


Capacitor asymmetry will not cause frequency drift. The frequency drift may be caused by the unstable capacitance of the crystal oscillator. You can try changing it. It is not difficult to change two capacitors. Otherwise, the stability of the crystal oscillator is too poor, or there is a problem with the measurement method.


Sixth, the question about the crystal oscillator and speed of the microcontroller. Isn't the cycle of executing an instruction determined by the crystal oscillator? For example, if the 51 microcontroller and MSP430 are connected to a high-speed crystal oscillator for the 51 and a low-speed crystal oscillator for the 430, will the 51 run faster? Is the speed of the microcontroller only related to the crystal oscillator? The key is whether the microcontroller can support such a large crystal oscillator?


The speed of each microcontroller is limited by the internal logic gate level jump speed. Two chips use the same crystal oscillator, such as 12M. Because AVR is a RISC instruction set, it is faster than 51 at the same external crystal oscillator frequency.


For example, the fastest speed of 51 is 40M, and AVR is a 16M crystal oscillator.


STC89C52 mostly uses 12MHz crystal oscillator, but because its 12 clock cycles are one machine cycle, its main frequency is only 1MHz.


MSP430 uses RISC reduced instruction set. If the 430 microcontroller uses internal DCO oscillation, the main frequency can reach 21MHz. A single clock cycle can execute an instruction. With the same crystal oscillator, the speed is 12 times faster than 51.


For a 51, if you use a higher crystal oscillator, the speed will be faster. But it is different for advanced microcontrollers. Advanced microcontrollers usually have frequency control registers inside, so simply adding a crystal oscillator may reach the limit of the microcontroller and cause it to run away.


7. Is there any way to determine whether a certain microcontroller can work properly under a certain size of crystal oscillator?


It is not appropriate to choose a crystal oscillator that is too high. I am afraid it is impossible to measure the specific upper limit of the crystal oscillator. We can only follow the requirements of the microcontroller. Generally, the upper limit of the STC series microcontroller is 35M or 40M. The upper limit of the STC series microcontroller is written on it, such as STC11F16XE 35I-LQFP44G, where 35I is an industrial-grade chip with a maximum crystal oscillator of 35M.


I have not tested what kind of problems will occur if the upper limit is exceeded. Generally, 12M is more common. If the STC 1T instruction is selected, it is equivalent to a 12*12=144M crystal. If used for serial communication, it is recommended to use 11.0592M or 22.184M. The most important thing to choose a crystal is to refer to the user's manual.


8. Can four AT89C51 microcontrollers all work properly with one 12M crystal oscillator? One uses the internal clock mode, and the other three use the external mode... Is it possible to use the internal mode for all four (connecting all four microcontrollers in parallel to one crystal oscillator)?


Yes, one of them is normally connected to the crystal oscillator, and its XTAL2 output is connected to the XTAL1 input of the other three.


9. The relationship between the operating speed of the microcontroller and the size of the crystal oscillator. If the maximum operating frequency of the microcontroller is 40M, can the crystal oscillator be selected as 24M or higher, but not more than 40M? Will the operating speed of the microcontroller be greatly increased? Will long-term operation at this operating frequency have adverse effects on the microcontroller? What is the principle of the microcontroller's selection of crystal oscillators?

[1] [2]
Reference address:Twenty-one questions about 51 single-chip microcomputer crystal oscillator

Previous article:51 MCU interrupt initialization and subroutine template
Next article:Simple and practical single chip microcomputer CRC fast algorithm

Latest Microcontroller Articles
Change More Related Popular Components

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号