51 Relevant knowledge of the minimum system of single-chip microcomputer

51 Relevant knowledge of the minimum system of single-chip microcomputer

The smallest single-chip microcomputer system, or called the smallest application system, refers to a system that can work with a single-chip microcomputer composed of the fewest components. For 51 series microcontrollers, the minimum system should generally include: microcontroller, crystal oscillator circuit, and reset circuit. The minimum system circuit diagram of a 51 single-chip microcomputer is given below.

img

Reset circuit:

1. The purpose of the reset circuit: The reset circuit of the single-chip microcomputer is like the restart part of the computer. When the computer crashes during use, press the reset button to start the program from the beginning. The same is true for single-chip microcomputer. When the single-chip microcomputer system is running and the program runs away due to environmental interference, press the reset button and the internal program will automatically start from the beginning. The microcontroller reset circuit is shown in the figure below:

2. The working principle of the reset circuit is introduced in the book. To reset the 51 single-chip microcomputer, it only needs to connect a high level to the 9th pin for 2US to realize it. How is this process realized? In the single-chip microcomputer system, the system resets once when the system is powered on, and the system resets again when the button is pressed. If it is released and then pressed, the system will also reset. Therefore, its reset can be controlled in the running system by opening and closing the key.

Why does it reset when booting: In the circuit diagram, the size of the capacitor is 10uF, and the size of the resistor is 10k. Therefore, according to the formula, it can be calculated that the capacitor is charged to 0.7 times the power supply voltage (the power supply of the microcontroller is 5V, so charging to 0.7 times is 3.5V), and the time required is 10K*10UF=0.1S. That is to say, within 0.1S when the microcontroller starts, the voltage across the capacitor increases at 0 to 3.5V. At this time, the voltage across the 10K resistor is reduced from 5 to 1.5V (the sum of the voltages across the series circuit is the total voltage). So within 0.1S, the voltage received by the RST pin is 5V~1.5V. In the 51 single-chip microcomputer that works normally at 5V, the voltage signal less than 1.5V is a low-level signal, and the voltage signal greater than 1.5V is a high-level signal. Therefore, within 0.1S of starting up, the single-chip system automatically resets (the time for the high-level signal received by the RST pin is about 0.1S).

Why does it reset when the button is pressed: After the MCU starts for 0.1S, the voltage across the capacitor C continues to charge to 5V. At this time, the voltage across the 10K resistor is close to 0V, and the RST is at a low level, so the system works normally. When the button is pressed, the switch is turned on. At this time, a loop is formed at both ends of the capacitor, and the capacitor is short-circuited. Therefore, during the process of pressing the button, the capacitor starts to discharge the previously charged power. As time goes by, the voltage of the capacitor is released from 5V to 1.5V or even less within 0.1S. According to the voltage of the series circuit is the sum of all places, the voltage across the 10K resistor is 3.5V or even greater at this time, so the RST pin receives a high level again. The microcontroller system automatically resets.

Crystal oscillator circuit:

Crystal oscillator circuit: Crystal oscillator is the abbreviation of crystal oscillator. Electrically, it can be equivalent to a two-terminal network in which a capacitor and a resistor are connected in parallel and then a capacitor is connected in series. Electrotechnically, this network has two resonance points, and the frequency is divided into low and low. The higher frequency is series resonance, and the higher frequency is parallel resonance. Due to the characteristics of the crystal itself, the distance between the two frequencies is quite close. In this extremely narrow frequency range, the crystal oscillator is equivalent to an inductor, so as long as the two ends of the crystal oscillator are connected in parallel. The capacitor will form a parallel resonant circuit. This parallel resonant circuit can be added to a negative feedback circuit to form a sine wave oscillation circuit. Since the crystal oscillator is equivalent to an inductance, the frequency range is very narrow, so even if the parameters of other components vary greatly, this oscillation The frequency of the device will not change much

An important parameter of the crystal oscillator is that the load capacitance value is equal to the parallel capacitance of the load capacitance value, and the nominal resonant frequency of the crystal oscillator can be obtained.

The general crystal oscillator circuit is connected to the crystal oscillator at both ends of an inverting amplifier (note that the amplifier is not an inverter), and then two capacitors are respectively connected to the two ends of the crystal oscillator, and the other end of each capacitor is connected to the ground. The capacity value of two capacitors in series should be equal to the load capacitance. Please note that the pins of general ICs have equivalent input capacitances, which cannot be ignored.

The load capacitance of the general crystal oscillator is 15pF or 12.5pF. If the equivalent input capacitance of the component pin is considered, two 22pF capacitors constitute the oscillator circuit of the crystal oscillator is a better choice.

As shown in the picture above: the crystal oscillator is to provide the working signal pulse for the single-chip microcomputer. This pulse is the working speed of the single-chip microcomputer. For example, the working speed of the 12M crystal oscillator single-chip microcomputer is 12M per second. Of course, the working frequency of the single-chip microcomputer has a range.

The oscillation circuit composed of the crystal oscillator and the XTAL0 and XTAL1 pins of the microcontroller will generate a consonant wave (that is, waves of other frequencies that are not expected to exist). This wave has little effect on the circuit but will reduce the stability of the clock oscillator of the circuit. For the stability of the circuit, ATMEL only recommends that two 10pf-50pf ceramic capacitors be connected to the ground at the two pins of the crystal oscillator to reduce the influence of the consonant wave on the stability of the circuit. Therefore, the capacitor equipped with the crystal oscillator should be between 10pf-50pf. There is no calculation formula

Pull-up resistor of P0 port:

When the P0 port is used as an I/O port output, the output low level is 0, and the output high level is high configuration (not 5V, equivalent to

floating state). That is to say, the P0 port cannot really output high level to provide current to the connected load, so a pull-up resistor must be connected (a resistor connected to VCC), and the power supply provides current to the load through this pull-up resistor. Because there is no pull-up resistor inside the P0 port, it is open-drain, no matter how much its driving capability is, it means that it has no power supply and needs to be provided by an external circuit. In most cases, a pull-up resistor must be added to the P0 port.

1. Generally, the P0 port of the 51 single-chip microcomputer is not connected with a pull-up resistor when it is used as an address/data multiplex.

2. When used as a general I/O port, since there is no pull-up resistor inside, it must be connected with a pull-up resistor! !

3. When the P0 port is used to drive the PNP tube, there is no need for a pull-up resistor, because the low level is valid at this time; 4. When the P0 port is used to drive the NPN tube, a pull-up resistor is required, because At this time, only when P0 is 1, can the rear end be turned on.

31-pin EA/Vpp connected to the power supply:

Special attention for STC89C51/52 or other 51 series compatible microcontrollers: For pin 31 (EA/Vpp), when connected to a high level, the microcontroller starts executing from 0000H of the internal ROM after reset; when connected to a low level, directly from the external The 0000H of the ROM starts to execute, which is easily overlooked by beginners.

Execute, when it is connected to low level, it will be executed directly from 0000H of the external ROM after reset, which is easily overlooked by beginners.

Guess you like

Origin blog.csdn.net/Jack_0220/article/details/128391700