Reset of 51 MCU

Publisher:温馨生活Latest update time:2013-12-02 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:Reset of 51 MCU

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

Calculator assembly language based on 51 single chip microcomputer
The calculators we talked about before were all based on C language. Next, let’s talk about a simple calculator based on assembly language. hardware design The display is still a digital tube, and the MCU is C51, which supports integer calculation. Simulation diagram: programming YJ EQU 50H ;Result storage YJ1 E
[Microcontroller]
Calculator assembly language based on 51 single chip microcomputer
8051 MCU (STC89C52) eight-segment digital tube static lighting
In the upper left corner of the STC89C52, there are eight eight-segment digital tubes. In the process of controlling the lighting of the digital tubes, only one digit can be lit at a time according to the high and low levels of the three pins P24, P23, and P22 (the three inputs of the 3-8 decoder). Here (P24, P23, P22
[Microcontroller]
8051 MCU (STC89C52) eight-segment digital tube static lighting
51 single chip microcomputer DS18B20 temperature sensor
1. Design requirements Design an intelligent temperature measuring instrument, use a temperature sensor to measure the ambient temperature, and have an over-temperature alarm function. It is required that the alarm temperature and alarm time can be set by pressing buttons, and the external temperature, alarm temperatu
[Microcontroller]
51 single chip microcomputer DS18B20 temperature sensor
51 single chip microcomputer - dynamic display of common anode digital tube
Schematic diagram and basic principle of digital tube Schematic I won't explain how it works. Fundamental Dynamic display is essentially to light up a single digital tube in turn to achieve the effect of multi-digit digital tube overall display. In the process of rotating display, each digital tube is lit for 1 to 2
[Microcontroller]
51 single chip microcomputer - dynamic display of common anode digital tube
Memory access of 51 single chip microcomputer W77E58
  The enhanced 51 series microcontroller W77E58 is compatible with the standard 8052. It contains four 8-bit I/O ports, three 16-bit counters and a full-duplex serial communication interface. Since the W77E58 has a redesigned processor core, its performance has been greatly improved compared to the standard 8052.    
[Microcontroller]
Memory access of 51 single chip microcomputer W77E58
Analyze some misunderstandings and precautions of C51 single chip microcomputer
Introduction: I often see beginners asking to use _at_. This is a fallacy, treating C as ASM. In C, variable location is the compiler's job. As long as beginners define the variable and its scope, the compiler will give the variable a fixed address. How to get the address of this variable? You need to use a pointer.
[Microcontroller]
The use of 51 MCU internal timer
/*------------------------------------------ Function: Use the internal timer 0 of the 51 MCU and output from port P1^0 Square wave with a period of 2ms Author: Zhang Kaizhou Date: 2019-5-14 22:44:19 ------------------------------------------*/ #include reg52.h sbit state = P1^0; void main() { TMOD = 0x01; // Set
[Microcontroller]
A simple design of electronic password lock based on 51 single chip microcomputer
  1 Background and design features of single chip electronic password lock   With the rapid development of high technology today, people have invented various forms of locks, such as password locks, electronic locks and laser locks. Based on traditional keys, these locks use magnetic fields, sound waves and light be
[Microcontroller]
A simple design of electronic password lock based on 51 single chip microcomputer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号