In order to solve the problem, I consulted a lot of information and textbooks on single-chip microcomputers. Almost all textbooks have the same definition of the role of the instruction "RETI": "After the interrupt program is completed, a RETI instruction must be executed. After executing this instruction, the CPU will take out the address stored in the stack and send it back to the PC, and then the program will continue to execute from the interruption point of the main program." If the role of "RETI" is only to "take out the address stored in the stack and send it back to the PC"; then can't I achieve the same effect of pushing the address by replacing it with the two instructions "POP DPH" and "POP DPL"? This can solve the stack overflow error caused by only pushing the stack instruction (automatically generated by the hardware) without popping the stack, but it cannot solve the "cannot enter the interrupt" problem mentioned at the beginning of the article. This makes me more convinced that the role of the instruction "RETI" introduced in the book is not complete. After consulting various materials and documents, I found a concept of "'priority effective' trigger" that was not mentioned in the textbooks and teachers when introducing single-chip microcomputer hardware and registers. The data points out that "according to the structural characteristics of 8051, its interrupt system contains two non-addressable "priority effective" triggers. One is used to indicate whether the CPU is executing a high-priority interrupt service program. When this trigger is 1, the system will block all interrupt requests; the other indicates whether the CPU is executing a low-priority interrupt service program. When this trigger is 1, it will block all interrupt requests except for high-priority ones. It can be seen that if you want to respond to interrupt requests of the same level or even lower level, you must clear the "priority effective" trigger. But this trigger is not addressable, so it cannot be cleared directly by software." Is the problem here? How is the "priority effective" trigger cleared? It is automatically executed by the hardware, so when is it executed? I will solve the problem with the problem. Suppose I can make the program jump to the original specified address "ADR16" after jumping out of the interrupt and satisfy the execution instruction "RETI". After repeated thinking, I used four instructions: "DEC SP"; "DEC SP"; "MOV DPTR, #ADR16"; "PUSH DPL"; "PUSH DPL" and "PUSH DPH" to replace them, and the problem was solved.
Summary: The interrupt instruction "RETI" as an interrupt jump instruction not only takes out the address stored in the stack and sends it back to the PC, so that the program can continue to execute from the interruption point of the main program, but also clears the "priority effective" trigger. This error also occurred in the program I made. Due to the clearing of the "priority effective" trigger, the second interrupt could not be entered (equivalent to the same priority application).
Postscript: The knowledge I used to solve this problem was from the textbook, but not entirely from the textbook. In this process, I used the knowledge I had learned to solve my own problem, and further introduced some new knowledge of the interruption process. I believe that the learning of new knowledge depends largely on the acquisition of new knowledge through the process of application, summary, deduction, etc. on the basis of the knowledge I have learned. This is also an ability of contemporary college students to apply knowledge and acquire new knowledge.
Previous article:Programming of Serial Communication between Two Single-Chip Microcomputers
Next article:How to use the built-in watchdog of 89S51 series microcontroller
Recommended ReadingLatest update time:2024-11-16 16:21
- 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
- First day of work in 2021
- TL335x-EVM development board processor, FLASH, RAM, FRAM
- DSP2812 CMD detailed configuration example
- 【ESP32-Korvo Review】 01 Unboxing Experience
- Exposed! Another unfinished semiconductor project: defrauding state-owned land and refusing to return it! Using the name of chips to engage in real estate?
- How to configure C2000 to enter low power mode
- Basic concepts of amplifier circuits and three basic connections
- Does the material of the transformer determine the operating frequency of the transformer?
- CV2880 simple datasheet
- Washing machine problems