About the concept of single-chip microcomputer interrupt system: What is an interrupt? Let's introduce it from a routine in life. You are reading a book at home, and suddenly the phone rings. You put down the book, answer the phone, talk to the caller, then put down the phone, and come back to continue reading your book. This is the phenomenon of "interruption" in life, that is, the normal working process is interrupted by external events. A careful study of interruptions in life is also very helpful for us to learn the interruption of single-chip microcomputers.
First, what can cause an interrupt? Many events in life can cause interrupts: someone presses the doorbell, the phone rings, your alarm goes off, the water you boiled... and so on. We call the events that can cause interrupts interrupt sources. There are also some events in the microcontroller that can cause interrupts. There are a total of 5 in 8031: two external interrupts, two counter/timer interrupts, and one serial port interrupt.
Second, the nesting and priority processing of interrupts: Imagine that we are reading a book, the phone rings, and someone presses the doorbell at the same time. What should you do first? If you are waiting for an important call, you generally won't pay attention to the doorbell. On the contrary, if you are waiting for an important guest, you may not pay attention to the phone. If it is neither of these two (i.e. not waiting for a call, nor waiting for someone to come to the door), you may handle it according to your usual habits. In short, there is a priority problem here, and the same is true in the microcontroller, there is also a priority problem. The priority problem not only occurs when two interrupts are generated at the same time, but also occurs when one interrupt has been generated and another interrupt is generated, such as when you are answering the phone and someone presses the doorbell, or when you are opening the door to talk to someone and the phone rings. Consider what we would do.
Third, the interrupt response process: When an event occurs, before entering the interrupt, we must first remember which page of the book we are reading, or take a bookmark and put it at the current page, and then go to handle different things (because after handling, we have to come back to continue reading): when the phone rings, we have to go to the place where the phone is placed, and when the doorbell rings, we have to go to the door. These are also different interrupts, and we have to handle them in different places, and this place is often fixed. This method is also used in computers. There are five interrupt sources. After each interrupt is generated, go to a fixed place to find the program to handle this interrupt. Of course, before going, you must first save the address of the instruction to be executed next, so that after handling the interrupt, return to the original place and continue to execute the program. Specifically, the interrupt response can be divided into the following steps: 1. Protect the breakpoint, that is, save the address of the next instruction to be executed, that is, send this address to the stack. 2. Find the interrupt entry, according to the interrupts generated by 5 different interrupt sources, find 5 different entry addresses. The above work is automatically completed by the computer and has nothing to do with the programmer. The interrupt handler is stored at these 5 entry addresses (this is where the program is written. If the interrupt program is not placed there, it is wrong and the interrupt program cannot be executed). 3. Execute the interrupt handler. 4. Interrupt return: After executing the interrupt instruction, it returns to the main program from the interruption point and continues to execute. How does the microcontroller find the location of the interrupt program and how does it return? We will talk about it later.
The structure of the MCS-51 microcontroller interrupt system:
The symbols, names and conditions for the occurrence of the five interrupt sources are as follows.
INT0: External interrupt 0, introduced by P3.2 port line, caused by low level or falling edge.
INT1: External interrupt 1, introduced by P3.3 port line, caused by low level or falling edge.
T0: Timer/Counter 0 interrupt, caused by T0 counting full and returning to zero.
T1: Timer/Counter 1 interrupt, caused by T1 counting full and returning to zero.
TI/RI: Serial I/O interrupt, caused by the serial port completing a frame of character transmission/reception.
The structural block diagram of the entire interrupt system is shown in Figure 1 below.
Previous article:51 MCU interrupt system structure
Next article:MCU Counters and Timers
- Popular Resources
- Popular amplifiers
- Algorithm Competition (Volume 2) (Scanned version) (Luo Yongjun and Guo Weibin)
- The Essentials of Reinforcement Learning: Core Algorithms and TensorFlow Implementation (Feng Chao)
- Algorithm Notebooks Practical Guide for Computer Training (Edited by Hu Fan and Zeng Lei)
- Algorithm Design (Jon Kleinberg Éva Tardos)
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
- [Atria Development Board AT32F421 Review] TEST06 CFFT related tests
- EasyARM-RT1052 Review] + Basic IoT transmission framework (final post)
- TCP/IP Detailed Explanation (Layer 7/Layer 4 Protocol)
- FPGA Selection Strategy.pdf
- How to connect esp8266 and pyboard using UART
- Medical device requirements for chip temperature
- Send Chip Coins: #What to do when you encounter problems with Guoxin#, technical support is rubbed on the ground?
- 【RPi PICO】MicroPython firmware with encryption support
- I want to use a 3.3v microcontroller to share power to control a relay, but the microcontroller stops working after grounding.
- Which circuit simulation company is the best?