When I first learned about the 51 microcontroller, there were always many questions about the crystal oscillator. In fact, the crystal oscillator is like the human heart, which is the blood and pulse. Once I understand the crystal oscillator problem of the microcontroller, other problems of the 51 microcontroller can be easily solved...
I have summarized the issues related to the crystal oscillator of the 51 microcontroller. I hope it will be helpful to children who are learning 51.
1. Why does 51 microcontroller like to use 11.0592MHZ crystal oscillator?
One: Because it can be accurately divided into clock frequencies, relative to common baud rates for UART (Universal Asynchronous Receiver/Transmitter) quantities. Especially for higher baud rates (19600, 19200), no matter how weird the value, these crystals are accurate and often used.
Second: The reason for using the 11.0592 crystal oscillator is caused by the timer of the 51 microcontroller. When using the timer of a 51 microcontroller as a baud rate generator, if a 11.0592Mhz crystal oscillator is used, the timer setting values calculated according to the formula are all integers; if a 12Mhz crystal oscillator is used, the baud rate will be biased. For example, 9600, use the timer to get 0XFD, the actual baud rate is 10000, generally the baud rate deviation is about 4%, so you can also use STC90C516 crystal oscillator 12M baud rate 9600, the error rate in multiples is 6.99%, no The error rate for multiples is 8.51%, and the data will definitely be wrong.
This is why everyone likes to use an 11.0592MHz crystal oscillator for serial communication. When the baud rate is doubled, it can reach a maximum of 57600 with an error rate of 0.00%. Using 12MHz, the maximum is only 4800, and there is an error rate of 0.16%, but it is within the allowable range, so it does not have much impact.
Second, when designing the 51 microcontroller system PCB, why is the crystal oscillator required to be next to the microcontroller?
The reason is as follows: the crystal oscillator generates mechanical vibration at a fixed frequency through electrical excitation, and the vibration generates current feedback to the circuit. After receiving the feedback, the circuit amplifies the signal, and again uses the amplified electrical signal to excite the crystal oscillator to mechanically vibrate, and the crystal oscillator then The current generated by the vibration is fed back into 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 sine wave with strong signal and stable frequency. The shaping circuit then turns the sine wave into a square wave and sends it to the digital circuit for use.
The problem is that the output capability 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 through an amplifier before it can be used normally.
The crystal oscillator and the IC are generally connected through a copper wire. This wire can be regarded as a section of wire or several sections of wire. When the wire cuts the magnetic line, it will generate current. The longer the wire, the stronger the current generated. In reality, magnetic field lines are not common, but electromagnetic waves are everywhere, such as wireless broadcast transmissions, TV tower transmissions, mobile phone communications, etc. The connection between the crystal oscillator and the IC becomes a receiving antenna. The longer it is, the stronger the signal received and the stronger the electrical energy generated, until the received electrical signal strength exceeds or is close to the signal strength generated by the crystal oscillator. , the amplifier circuit in the IC will no longer output a fixed-frequency square wave, but a messy signal, causing the digital circuit to fail to work synchronously and cause errors.
Therefore, when drawing the 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 vibrate
It is a common phenomenon that the crystal oscillator of a microcontroller cannot vibrate. So what are the reasons why the crystal oscillator cannot vibrate?
①PCB board wiring error;
②There is a problem with the quality of the microcontroller;
③There is a problem with the quality of the crystal oscillator;
④The load capacitor or matching capacitor does not match the crystal oscillator or there is a problem with the capacitor quality;
⑤The PCB board is damp, resulting in impedance mismatch and failure to vibrate;
⑥The wiring of the crystal oscillator circuit is too long;
⑦There are traces between the two legs of the crystal oscillator;
⑧Influence of peripheral circuits.
As a solution, it is recommended to troubleshoot the fault one by one as follows:
①Exclude the possibility of circuit errors, so you can use the recommended circuit of the corresponding model of microcontroller for comparison.
②Exclude the possibility of defective peripheral components, because the peripheral components are nothing more than resistors and capacitors, and it is easy to identify whether they are good products.
③Exclude the possibility that the crystal oscillator is a stopped product, because you will not only try one or two crystal oscillators.
④ Try changing the capacitors at both ends of the crystal. Maybe the crystal oscillator can start to oscillate. Please refer to the instructions for use of the crystal oscillator for the size of the capacitor.
⑤ When wiring the PCB, the wiring of the crystal oscillator circuit should be as short as possible and as close as possible to the IC, and avoid wiring between the two legs of the crystal oscillator.
Fourth, how do you get the value of the capacitor when the 51 microcontroller clock circuit uses a 12MHZ crystal oscillator? Let’s take the internal clock circuit to illustrate!
In fact, no one can explain clearly 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. It is used in conjunction to correct the waveform. No one has delved into why it has such a large value.
19.What will be the consequences if the 19.89c52 microcontroller is not connected to a crystal oscillator?
The microcontroller stops working, the program cannot be burned in...etc.
5. What will happen if the two trimming capacitors in the microcontroller crystal oscillator circuit are asymmetrical? How much difference will cause the frequency to change? When testing the receiving module of the wireless mouse, it was found that its frequency always changes slowly (that is, never letting go of the probe). The frequency gradually becomes smaller) The crystal oscillator is new!
Asymmetric capacitance 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 replace the two capacitors. Otherwise, the stability of the crystal oscillator is too poor. There may be something wrong with the measurement method.
Sixth, there is a question about the crystal oscillator and speed of the microcontroller. Isn’t the cycle of executing an instruction determined by the crystal oscillator? So for example, if 51 microcontroller and MSP430 are connected to a high-speed crystal oscillator and 430 is connected to a low-speed one, does 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 speed of internal logic gate level transitions. Both chips use the same crystal oscillator at the same time, such as 12M. Because AVR is a RISC instruction set, it is faster than 51 at the same external crystal oscillator frequency.
For example, 51 can connect to 40M at the fastest, and AVR is a 16M crystal oscillator.
Most STC89C52 uses a 12MHz crystal oscillator, but since its 12 clock cycles are one machine cycle, it is equivalent to its main frequency being only 1MHz.
MSP430 uses RISC reduced instruction set. If the 430 microcontroller uses internal DCO oscillation, it can reach a main frequency of 21MHz. A single clock cycle can execute an instruction, and the same crystal oscillator is 12 times faster than 51.
For a 51, use a higher crystal oscillator and the speed will be faster. But it is different for advanced microcontrollers. Advanced microcontrollers generally have frequency control registers inside them. Therefore, simply adding a crystal oscillator may reach the limit of the microcontroller and cause it to run out of control.
7. I would like to ask: Is there any way to determine whether a certain microcontroller can work normally with a crystal oscillator of a certain size?
It is not appropriate to choose a crystal oscillator that is too high. I’m afraid I can’t measure the specific upper limit of the crystal oscillator. I can only follow the requirements of other people’s microcontrollers. Generally, the upper limit of STC series microcontrollers is 35M or 40M. It is written on the stc alone, such as STC11F16XE35I-LQFP44G. 35I is an industrial-grade chip with a crystal oscillator up to 35M.
What kind of problems will occur if the upper limit is exceeded? I have not tested it. Generally, 12M crystal oscillators are chosen. If you choose the STC1T instruction, it is equivalent to a 12*12=144M crystal oscillator. If it is used for serial communication, it is recommended to choose 11.0592M or 22.184M. The most important thing when choosing a crystal oscillator is to refer to other people's instructions.
8. Can four AT89C51 microcontrollers use a 12M crystal oscillator to make them all work normally? One uses the internal clock mode, and the other three use the external mode... It is not necessary for the four to use the internal mode (all four microcontrollers are connected in parallel on a crystal oscillator)?
Previous article:c51 special function register definition and function
Next article:Humidity monitoring simulation and program based on 51 microcontroller
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- GoKit Case Study: Gizwits IoT Development Platform’s Pet House Transformed into an Air Quality Detector
- Embedded licensing: why not and why not?
- I found a 1963 "Electron Tube Handbook"
- How to extract the effective value of fundamental wave and each harmonic in MATLAB?
- Analysts predict Bluetooth location services will grow at a CAGR of 32% by 2025
- TI blog post - Introduction to basic parameters of analog switches and multiplexers
- Bluetooth chip
- How many versions of the C language main function are there? Which one is right?
- stm32f4 serial port 3 prompts NE error
- Design and implementation of asynchronous FIFO based on Verilog HDL.pdf