Want to learn microcontroller design, these most common problems you have to solve

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.

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 times 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 single-chip quality problems; 3 crystal quality problems;

4 load capacitor or matching capacitor does not match the crystal oscillator or the quality of the capacitor is faulty; 5 PCB board is damp, resulting in impedance mismatch and can not start; 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 Exclude the possibility of bad external components, because the peripheral parts are nothing but resistors and capacitors. It is easy to identify whether it is good or not. 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 does not work, 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 frequency slowly getting 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. The 430 microcontroller can achieve an internal frequency of 21MHz if it uses internal DCO oscillation. 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.

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, the general STC series MCU upper limit is 35M or 40M, stc alone on the written, such as STC11F16XE 35I-LQFP44G Among them, 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 general crystal oscillator selects 12M more. If the STC 1T command is selected, it is equivalent to the crystal oscillator of 12*12=144M. 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.

Nine, the relationship between the operating speed of the single-chip microcomputer and the size of the crystal oscillator. If the maximum operating frequency of the single-chip microcomputer is 40M, can the crystal oscillator be 24M or higher, but not more than 40M, so is the operating speed of the single-chip microcomputer greatly increased? Long-term at this working frequency Is there any adverse effect on the microcontroller? What is the principle of the choice of the microcontroller for the crystal oscillator?

Of course, it is influential. The faster the working speed of the MCU, the greater the power consumption, and the more the interference will be. In short, the maximum can run 40M, and the running is not more than 40M, there is no problem, just related technology (such as The selection of PCB design components, etc.) will be much higher.

Ten, 89c51 single-chip reset circuit often uses 12MHZ crystal oscillator, in fact, the market is slightly smaller than 12MHZ, why?

A: When you need serial communication, you usually use 11.0582MHZ, so the baud rate is good.

It is easy to calculate with a duty cycle of 12 MHz.

Eleven, the single crystal crystal oscillator does not vibrate, but the crystal touches the crystal when it touches it. Why? How to judge whether the crystal oscillator of the single chip starts to vibrate?

Look at the crystal matching capacitor welding, is there any error?

The easiest way is to use an oscilloscope. Also, you can see if the power supply is normal.

Twelve, how to judge whether the external crystal oscillator of the single-chip oscillator has started? The STC89C52 single-chip microcomputer was originally good, but it will not work. It will be better to change the crystal oscillator. But after a few hours, it will not work, what is going on. There is also how to determine whether the crystal oscillator starts to oscillate?

1 first try to replace a single-chip, the problem is still to exclude the microcontroller; 2 may be caused by the virtual welding, this should pay attention to; 3 with STC89C52 also encountered a similar problem, changed the crystal oscillator is OK, as if STC The vibration is not as smooth as the AT89S52. In fact, for the STC89C52 you can directly look at the 30 feet (ALE), pick up a light, and you can see it at once.

Thirteen, 51 how to choose the size of the capacitor connected to the crystal oscillator? Is the crystal oscillator bigger, the capacitance value is also larger, generally used. Some people say that the commonly used from 15-33pf, how to choose the best effect? ​​For example, a 6M and 12M crystal, respectively, how much more suitable capacitor?

15-33pf can generally be used 15P and 30P crystal oscillator size is not very common 4M and 12M and 11.0592M and 20M 24M are used 30P microcontrollers have corresponding shaping circuits inside are not worried

23. What happens to the 51 MCU 12M crystal connected to the 2200pF capacitor? The circuit diagram looks like 22pF, but there is no 22pF... Will 2200pF not work properly?

No, the crystal will not work. 15-33p is a reasonable range. Can give it a try, there will be no damage to the microcontroller.

Fourteen, there is no blank chip of the program, can the external crystal oscillator start?

If there is no internal crystal oscillator, the external crystal oscillator can start to vibrate. For example, the traditional MS51 series MCU has an internal crystal oscillator, and the external crystal oscillator will not start. It needs to be configured after the external crystal oscillator is activated. If the external crystal oscillator is not configured, Use internal crystal oscillator, such as silicon lab series C8051F020 microcontroller

Fifteen, why at89c52 P1.0 output 2.5v voltage, the microcontroller does not seem to work, the crystal oscillator waveform is irregular sine wave can not? The circuit board does not achieve the expected effect, the LED is always bright, I feel the problem of the microcontroller, P1.0 Output 2.5v voltage, X5045 for watchdog. what happened?

Remove the watchdog and temporarily make the minimum system, which is only the power supply, the 8952, the crystal oscillator and two capacitors of about 30P.

1 Set the P1.0 port to 1, and test whether the voltage of the port is above 2.5V;

2 Set the P1.0 port to 0, and test whether the voltage change is about 0V.

If yes, it is OK, otherwise you should look at the power supply voltage, crystal oscillator, and 8952. The power supply voltage is 5+, -0.25V, and the ripple must be small

Sixteen, the production of max232 download microcontroller, the working voltage is normal, to add a crystal oscillator?

Of course, if you do not add an external crystal oscillator, then the clock circuit of the MCU will be gone, and the serial port of the MCU will not be able to transfer data. Finally, the download device cannot download the program.

Seventeen, if the 89c52 single-chip microcomputer uses an external crystal oscillator, how should it be set?

The two pins of the crystal oscillator are connected to a capacitor of 20~30pf and then connected to the XTAL1 and XTAL2 of the single-chip microcomputer. The other ends of the two capacitors are connected and grounded, no need for any setting.

Eighteen, the principle of crystal oscillator, how to generate sinusoidal signal, in detail, from the circuit aspect analysis?

The crystal can be equivalent to an inductor, forming an oscillating circuit with the capacitor inside, and the energy is slowly from the inductor to the capacitor, and then slowly from the capacitor to the inductor, and the oscillation is repeated. The positive half cycle is the charging and discharging process of the capacitor, and the negative half cycle is the charging and discharging process of the inductor.

Nineteen, now I need to use a 52 MCU to make a traffic light circuit. The requirements are red light, green light 30s, yellow light 3s. Cycling changes. So how to choose the external crystal oscillator? How much is the single instruction cycle? What is the role of the two external capacitors in the figure? How much is the size?

If you choose a crystal oscillator, the two capacitor values ​​can be selected: 30 plus or minus 10 PF (frequency between 0 and 33 MHz);

If you choose a ceramic crystal, the capacitance value can be selected: 40 plus or minus 10PF (frequency is 1.2~12MHZ). The oscillator should be as close as possible to the capacitor. The instruction cycle is ok, this is a formula!

Twenty, 89c52 single-chip crystal frequency is only 12 trillion, too small, how can I change the large crystal frequency?

Externally connected to a 18.432 or 24MHz crystal. Or change the 4T W77E58 microcontroller, which is equivalent to increase the operating frequency by 3 times. Or change the 1T DS89C4XX microcontroller, which is equivalent to increase the operating frequency by 8 times! The 1T STC12C5A60S2 microcontroller also has this effect.

XXI microcontroller is not working properly, the crystal problem? How to check crystal normal or abnormal? Also see that the crystal with two small capacitors to be very close, almost no shear pin (how long it is to buy back how long) to plug in to, this also has to do with it?

Use a multimeter to measure the two pins connected to the crystal oscillator. The voltage in the normal starting state is about a little lower than 1/2 of the power supply voltage. If one or all of the pins are the power supply voltage or zero, it means no vibration. The longer the pin will generally have no effect. In contrast, the grounding is more critical. The grounding of the two resonant capacitors should be as close as possible to the power supply of the microcontroller.

600Mbps Wireless-wifi Repeater

About this item

1. Ideal for boosting existing network to hard-to reach area, delivering fast and stable wireless connection, transfer rate up to 600Mbps

2. Repeater/AP modes for extending wifi or create wifi hotspot, watch video on line, play games, online shopping without interference

3. Activate passion for your life, mobile devices at full signal, wall mounted design flexible to place and 7 steps to finish setup

4. Designed with mobility and portability, little gadget with great value, One-touch wireless security encryption with WPS button

5. Ethernet port allows the Extender to function as a wireless adapter to connect wired devices, Compatible with 802.11n/g/b devices


2 Working Modes:(Select based on your needs)

Repeater Mode

Plug WiFi Booster into your power socket, easily expand your existing WiFi coverage to signal dead zones

Access Point Mode

Connect your router signal with Ethernet Cable, cover a wired network to a wireless access point.

600Mbps Wireless-Wifi Repeater,Wifi Amplifier,Wireless Extender,Wifi Booster For Home

Shenzhen Jinziming Electronic Technology Co.,LTD , https://www.powerchargerusb.com

Posted on