The CPU temporarily interrupts its current work (this is called interrupt response) and switches to processing event B (this is called interrupt service).
2. The interrupt system of 89C51 has 5 interrupt sources (in order of priority: external interrupt 0, timer interrupt 0, external interrupt 1, timer interrupt 1, serial port interrupt), 2 priorities, and can realize secondary interrupt nesting (an interrupt with a higher priority occurs during the interrupt processing process). Advanced microcontrollers may have more interrupt sources and more priorities.
3. The interrupt priority of 89C51 microcontroller has three principles:
(1) When the CPU receives several interrupts at the same time, it responds to the interrupt request with the highest priority first. (2) The ongoing interrupt process cannot be interrupted by a new interrupt request of the same or lower priority. (3) The ongoing low-priority interrupt service can be interrupted by a high-priority interrupt request. (To implement the latter two principles, the system has two non-addressable priority triggers. One of them is set to 1, indicating that it is responding to a high-priority interrupt and will block all subsequent interrupt requests; the other is set to 1, indicating that it is responding to a low-priority interrupt and will block all subsequent low-priority interrupt requests.)
4. The CPU's development and shielding of all interrupts of the interrupt system and a certain interrupt source are controlled by the interrupt enable register IE.
5. Interrupt response conditions:
(1) The interrupt source has an interrupt request; (2) The interrupt enable bit of this interrupt source is 1; (3) The CPU turns on the interrupt (i.e. EA = 1).
6. What does a programmer need to do to use interrupts?
(1) Which interrupt to use (external interrupt, timer interrupt, serial port interrupt, etc.) determines the interrupt number to respond to; (2) What conditions are expected to trigger the interrupt, such as falling edge trigger or low level trigger; (3) What to do after the interrupt (the interrupt service program should be as short as possible).
For example: a. Set the response value in IE - EA is set to 1 (allow CPU interrupts) and turn on the interrupt to be used; b. Set the trigger mode of the corresponding interrupt in TCON (as shown in the TCON register below); c. Write the interrupt service program (void function name () interrupt interrupt number using any value from 0 to 3 { function body }, where the value from 0 to 3 indicates selecting one of the four groups of registers on the chip to save the scene before the interrupt. It is usually recommended that beginners do not write "using any value from 0 to 3" because you are not clear about the usage of the internal registers. If you do not write it, Keil will automatically specify it for you.)
7. External interrupt:
IT0 (TCON.0) determines whether external interrupt 0 is low level active or falling edge active (from high level to low level). Similarly, IT1 (TCON.2) corresponds to external interrupt 1.
Previous article:51 MCU external interrupt example
Next article:Embedded Learning Notes 10——51 MCU Interrupt Timer Interrupt
Recommended ReadingLatest update time:2024-11-17 02:29
- 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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- Application of electromagnetic functional composite materials in radar antenna covers
- Switching power supply with extremely wide input voltage range
- Noise Countermeasures Using Capacitors
- I have a few questions about the WM8978 audio amplifier board.
- Guess what development board this is?
- Digital Circuits and Digital Systems: Experiments and Course Design Training Course
- AT91SAM7S256 serial port data loss
- Using DSP motor speed measurement and detailed explanation
- Low-power Qorvo chips enhance connectivity and reliability for new Luna smart home system
- Highlights of Bluetooth Mesh Technology