Analysis of basic knowledge of single-chip reset circuit

The following is my understanding of the reset circuit of the microcontroller:

1. Why does the MCU need to be reset?

Return the MCU to the initial state and execute the program from the 0 address of the PC pointer

2. How to reset the MCU ? (How to operate to ensure MCU reset)

Requirements: To reset the 51 single- chip microcomputer, it only needs to connect pin 9 to a high level for 2 machine cycles ( 2*12=24 clock cycles); that is , to lock the single-chip microcomputer in the reset state within 2 machine cycles. (because the MCU can only execute the reset command after two machine cycles)

3. Immediately reset after power-on? (i.e. power up and reset at the same time)

3.1 . How to reset?

The two preconditions for reset are: 1 ) The CPU is working normally ( the execution of the reset command needs to be executed by the CPU ), and the CPU is working normally

( A : VCC power supply is stable; B : crystal oscillator starts)

2 ) CPU detects reset signal (ie RST pin is high)

3.2 : It takes time for the crystal oscillator to start oscillating, and the power supply is stable, so it will not be reset immediately after power-on, but it is certain (there is a reset signal when power-on, it is a falling process, using 5V to 1.5V , lasting about 0.1s ); but , it is useless to have a reset signal alone. To perform a reset operation, wait for the first condition in 3.1 to be fulfilled. If the CPU is not working properly, the reset command cannot be executed

(At power-on, the rise time of VCC is about 10ms , and the start-up time of the oscillator depends on the oscillation frequency. For example, when the crystal frequency is 10MHz , the start-up time is 1ms ; when the crystal frequency is 1MHz , the start-up time is 10ms );

In summary, the duration of the RST reset signal of the microcontroller (about 0.1s ) is much longer than the two machine cycles necessary for reset (excluding the waiting time of more than 10ms before power- on, the rest time is 0.1s-10ms , the microcontroller is locked in reset state, the microcontroller always executes the reset command), which also ensures that the microcontroller can reliably realize the reset operation

4. What does the microcontroller do in the two machine cycles of reset?

Mainly initialize each register, including the most important PC pointer, excluding ram , and then MCU starts to execute the program from the reset address.

5. Analysis of reset process

Why does it reset at boot

In the circuit diagram, the capacitor is 10uF and the resistor is 10K . Therefore, according to the formula, it can be calculated that the time required to charge the capacitor 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 ) is 10K*10uF=0.1s . In other words, within 0.1s after the computer starts, the voltage across the capacitor increases between 0~3.5V . At this point, the voltage across the 10K resistor decreases from 5~1.5V (the sum of the voltages of all parts of the series circuit is the total voltage). Therefore, 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, the MCU system will automatically reset within 0.1s after startup (the high level signal received by the RST pin lasts about0.1s )。

Why does it reset when the key is pressed

After the microcontroller starts up 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 , RST is at a low level, and the system works normally. When the key is pressed, the switch is turned on. At this time, the two ends of the capacitor form a circuit, and the capacitor is short-circuited. So during key press, the capacitor starts to discharge charge before charging. Over time, the voltage of the capacitor changes from 5V to 1.5V or even lower in 0.1s . According to the series circuit voltage is the sum of all parts, at this time the voltage across the 10K resistor is 3.5V or even higher, so the RST pin receives a high level again. The microcontroller system resets automatically.

 

Guess you like

Origin blog.csdn.net/m0_67034740/article/details/124099015