Learning 51 single-chip crystal crystal 21 problems to understand learning microcontroller is simple

When I first learned 51 single-chip microcomputers, there was always a lot of problems related to the crystal oscillator. In fact, the crystal oscillator is like the human heart, the blood is the pulse, the crystal oscillator problem of the single-chip microcomputer is understood, and the other problems of the 51 single-chip microcomputer are solved...

The 51-single-chip related crystal oscillators are summed up, and I hope that it will be helpful for the children's shoes of 51.

Learning 51 single-chip crystal crystal 21 problems to understand learning microcontroller is simple

First, why does 51 MCU love to use 11.0592MHZ crystal oscillator?

One: Because it can be accurately divided into clock frequencies, it is related to the common baud rate of UART (Universal Asynchronous Receiver/Transmitter). Especially the higher baud rate (19600, 19200), no matter how weird the values, these crystals are accurate and often used.

Second: the reason for using the 11.0592 crystal oscillator is caused by the timer of 51 single-chip microcomputer. When using the 51 MCU timer to do the baud rate generator, if you use the 11.0592Mhz crystal oscillator, the values ​​set by the timer are all integers according to the formula; if you use the 12Mhz crystal oscillator, the baud rate is biased. For example, 9600, using timer to take 0XFD, the actual baud rate is 10000, the general baud rate deviation is about 4%, so you can also use STC90C516 crystal 12M baud rate 9600, the error rate is 6.99% when multiple, no When the multiple error rate is 8.51%, the data will definitely go wrong.

This is the reason why everyone likes to use the 11.0592MHz crystal oscillator during serial communication. When the baud rate is double, the maximum can reach 57600 and the error rate is 0.00%. With 12MHz, the highest is 4800, and there is a 0.16% error rate, but within the allowable range, so it does not have much impact.

Second, when designing the 51 single-chip 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 of a fixed frequency by electric excitation, and the vibration generates current feedback to the circuit. After the circuit receives the feedback, the signal is amplified, and the amplified electrical signal is used to excite the crystal vibration of the crystal oscillator. The current generated by the vibration is fed back to the circuit, and so on. When the excitation electric signal in the circuit and the nominal frequency of the crystal oscillator are the same, the circuit can output a strong, frequency-stable sine wave. The shaping circuit then converts the sine wave into a square wave for use in the digital circuit.

The problem is that the crystal's output capability is limited, it only outputs electrical energy in milliwatts. Inside the IC (Integrated Circuit), this signal is amplified by a few hundred or even thousands of times by an amplifier to be used normally.

The crystal oscillator and the IC are usually connected by copper traces. This trace can be regarded as a length of wire or a number of wires. When the wire is cut, the current will be generated. The longer the wire, the stronger the current generated. In reality, magnetic lines of force are not common, and electromagnetic waves are everywhere, such as: radio broadcasts, television tower launches, cell phone communications, and so on. The connection between the crystal and the IC becomes the receiving antenna. The longer it is, the stronger the received signal is, and the stronger the generated electrical energy is until the received electrical signal strength exceeds or approaches the signal strength generated by the crystal. The output of the amplifying circuit in the IC will no longer be a square wave of a fixed frequency, but a messy signal, which causes the digital circuit to fail to work synchronously and error.

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

Third, the reason why the crystal oscillator of the single-chip circuit does not vibrate

It is a common phenomenon to encounter the crystal oscillator of the single chip, so what are the reasons for the crystal oscillator?

1 PCB board wiring error;

2 The quality of the single chip has a problem;

3 crystal quality problems;

4 The load capacitor or matching capacitor does not match the crystal oscillator or the capacitor quality is faulty;

5 PCB board is damp, resulting in impedance mismatch and unable to start vibration;

The wiring of the 6 crystal oscillator circuit is too long;

7 crystal oscillator has a trace between the two feet;

8 The influence of peripheral circuits.

Solution, it is recommended to troubleshoot one by one as follows:

1 Eliminate the possibility of circuit errors, so you can use the recommended circuit of the corresponding type of microcontroller to compare.

2 Eliminate the possibility of poor external components, because the peripheral parts are nothing but resistors, capacitors, it is easy to identify whether it is good.

3 Exclude the possibility that the crystal oscillator is a vibration stop product, because it will not only test one or two crystal oscillators.

4 Try to change the capacitance at both ends of the crystal. Maybe the crystal oscillator can start to vibrate. Please refer to the crystal oscillator for the size of the capacitor.

5 When the PCB is routed, the trace of the crystal oscillator circuit should be as short as possible and as close as possible to the IC, so as to prevent the trace between the two legs of the crystal.

Fourth, 51 single-chip clock circuit with 12MHZ crystal oscillator when the value of the capacitor is derived? Take the internal clock circuit to explain it!

In fact, no one of these two capacitors can explain how to choose the value, because 22pF is really too small. This can only be said to have a relationship with the internal oscillator circuit's own characteristics, used together to correct the waveform, no one to go deep into why it is such a large value.

What is the consequence of 19.89c52 microcontroller if it is not connected to the crystal oscillator?

The microcontroller is not working, the program can't burn in...etc.

5. What is the asymmetry of the two trimmer capacitors in the crystal oscillator circuit of the single-chip microcomputer? How much difference will the frequency change? When detecting the receiving module of the wireless mouse, it is found that the frequency is always changing slowly (that is, the hand of the probe has not been loosened and found The frequency is getting smaller and smaller) The crystal is new!

Capacitance asymmetry will not cause frequency drift. The frequency drift mentioned may be caused by the unstable capacitance of the crystal oscillator. It can be changed. It is not difficult to change the two capacitors. Otherwise, the stability of the crystal oscillator is too bad. Or, there is a problem with the method of measurement.

Sixth, the question of the crystal oscillator and speed of the single chip, the cycle of executing an instruction is not determined by the crystal oscillator. Then, for example, 51 single-chip microcomputer and MSP430, 51 high-speed crystal oscillator, 430 low speed, is it faster to run 51? Is the speed of the single-chip microcomputer only related to the crystal oscillator, the key is whether the single-chip microcomputer can support such a large crystal oscillator?

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

For example, 51 can connect 40M at the fastest, and AVR is a 16M crystal oscillator.

Most of the STC89C52 uses a 12MHz crystal oscillator, but because of its 12 clock cycles, it is a machine cycle, which is equivalent to only 1MHz.

The MSP430 uses the RISC reduced instruction set. If the 430 microcontroller uses the internal DCO oscillation, it can reach the 21MHz main frequency. An instruction can be executed in a single clock cycle, the same crystal, 12 times faster than 51.

For a 51, give him a higher crystal, the speed will be faster. But for advanced microcontrollers it is different. Inside the advanced MCU, there are generally frequency control registers. Therefore, simply increasing the crystal oscillator may reach the limit of the MCU, resulting in runaway.

Learning 51 single-chip crystal crystal 21 problems to understand learning microcontroller is simple

Seven, I would like to ask: Is there any way to determine whether a single-chip microcomputer can work normally under a crystal oscillator of a certain size?

Crystal oscillator selection is too high is not suitable, the specific crystal oscillator upper limit is, I am afraid it can not be measured, can only be in accordance with the requirements of other people's single-chip microcomputer, the general STC series MCU upper limit is 35M or 40M, stc alone on the written, such as STC11F16XE35I-LQFP44G The 35I is an industrial grade chip with a crystal oscillator of up to 35M.

What kind of problems will occur if the upper limit is exceeded. If there is no test, the crystal oscillator is more than 12M. If the STC1T command is selected, it is equivalent to a 12*12=144M crystal oscillator. If it is used for serial communication, it is recommended to use 11.0592M or 22.184M. The most important choice for crystal oscillator is to refer to the manual of others.

Eight, four AT89C51 microcontrollers can use a 12M crystal oscillator to make them work normally? One uses the internal clock mode, the other three use the external mode...the four are all internal mode can not (the four MCUs are connected in parallel On a crystal)?

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

300W Medical Power Supply

300W Medical Power Supply,300W Medical Device Power Supply,300W Medical Power Adapter,300W Rade Power Supplies

Shenzhen Longxc Power Supply Co., Ltd , https://www.longxcpower.com