Reset is the initialization operation of the microcontroller. When the microcontroller starts running, it needs to be reset first. Its function is to put the CPU and other components in the system in a certain initial state and start working from this state. Therefore, reset is a very important operation mode. However, the microcontroller itself cannot reset automatically, and must be implemented with the corresponding external circuit.
Reset circuit:
When the reset pin RST (full name RESET) of the MCS-5l series microcontroller is at a high level for more than 2 machine cycles, the microcontroller performs a reset operation. If RST continues to be at a high level, the microcontroller is in a cyclic reset state.
Depending on the application requirements, reset operations usually have two basic forms: power-on reset and power-on or switch reset.
Power-on reset requires that the reset operation is automatically realized after the power is turned on. The commonly used power-on reset circuit is shown in the left figure of Figure A below. In the figure, capacitor C1 and resistor R1 form a differential circuit for power supply + 5V. After power-on, RST is kept at a high level for a period of time. Due to the effect of the equivalent resistance in the microcontroller, the power-on reset operation function can be achieved without the resistor R1 in the figure, as shown in the right figure of Figure (A) below.
Power-on or switch reset requires that the microcontroller automatically resets after the power is turned on, and the microcontroller can also be reset by using a switch during operation. The commonly used power-on or switch reset circuit is shown in the figure (B) above. After power-on, due to the charging of capacitor C3 and the action of the inverting gate, RST remains at a high level for a period of time. When the microcontroller is already running, pressing the reset button K and then releasing it can also make RST a high level for a period of time, thereby realizing the power-on or switch reset operation.
Based on actual operating experience, the reference values of capacitance and resistance for these two reset circuits are given below.
In the figure above (A): Cl = 10-30uF, R1 = 1kO
In Figure 1.27(B) above: C: = 1uF, Rl = 1kO, R2 = 10kO
The state of the microcontroller after reset:
The reset operation of the MCU puts the MCU into the initialization state, which includes setting the program counter PC = 0000H, which means that the program starts to execute from the address unit 0000H. After the MCU is cold started, the on-chip RAM is a random value. The reset operation in progress does not change the contents of the on-chip RAM area. The states of the 21 special function registers after reset are fixed values, as shown in the table below. [page]
It is worth pointing out that remembering the main states of some special function registers after reset is necessary to understand the initial state of the microcontroller and reduce the initialization part in the application.
Note: The symbol * in the table indicates a random state;
A=00H, indicating that the accumulator has been cleared;
Special Function Registers |
Initial state |
Special Function Registers |
Initial state |
A |
00H |
TMOD |
00H |
B |
00H |
TCON |
00H |
PSW |
00H |
TH0 |
00H |
SP |
07H |
TL0 |
00H |
DPL |
00H |
TH1 |
00H |
DPH |
00H |
TL1 |
00H |
P0~P3 |
FFH |
SBUF |
indefinite |
IP |
***00000B |
SCON |
00H |
IE |
0**00000B |
PCON |
0*******B |
PSW=00H, indicating that register group 0 is selected as the working register group;
SP = 07H, indicating that the stack pointer points to the 07H byte unit of the on-chip RAM. According to the stack operation rule of first adding and then pushing, the first content pushed is written to the 08H unit;
Po-P3 = FFH, indicating that 1 has been written to each port line. At this time, each port can be used for both input and output;
IP=×××00000B, indicating that each interrupt source is at a low priority;
IE=0××00000B, indicating that all interrupts are turned off;
System reset is the first step of any microcomputer system, which makes the whole control chip return to the default hardware state. The reset of 51 single chip microcomputer is controlled by RESET pin. After this pin is connected to high level for more than 24 oscillation cycles, 51 single chip microcomputer enters the internal reset state of the chip and waits in this state until RESET pin turns to low level, then checks whether EA pin is high or low level. If it is high level, the program code inside the chip is executed, if it is low level, the external program is executed.
When the 51 microcontroller is reset, some important registers inside it are set to specific values, while the data in the internal RAM remains unchanged.
Previous article:Four methods of extending interrupts of 51 single-chip microcomputers
Next article:Design of Automatic Resistance Tester Based on AT89S52
Recommended ReadingLatest update time:2024-11-16 22:55
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Fundamentals and Applications of Single Chip Microcomputers (Edited by Zhang Liguang and Chen Zhongxiao)
- Single chip microcomputer control technology (Li Shuping, Wang Yan, Zhu Yu, Zhang Xiaoyun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- HPM6750 CAN and GPIO parallel data reading test, not implemented
- How to analyze this circuit
- Free application: the latest digital function generator, if you fail to apply, you can eat "chicken legs" and win gifts such as flexible ink screen
- [April 23 | Suzhou] High-speed digital and optical communication test seminar invites you to meet
- Selection of power supply decoupling capacitors
- 【Anxinke NB-IoT Development Board EC-01F-Kit】3. Serial port networking test
- STM32 DCMI driver OV2640 project source code
- Embedded USB driver-free device communication method based on WinUSB
- Generate random 0,1 signal
- Problems using Saber to simulate SPWM driving H-bridge via 2110