Normally, RET is used to return in ordinary assembly subroutines, and RETI is used to return from interrupts in interrupt service subroutines. Both instructions can pop the breakpoint address from the stack and load it into the PC, allowing the CPU to return to the original breakpoint of the main program and continue running.
However, RET and RETI have essential differences: when an interrupt source is responded, one of the flag registers flag H and flag L in the microcontroller will be automatically set to prevent the triggering of interrupts of lower or same level than it. RETI can clear the "priority activation trigger" (i.e., flag register) to ensure timely response to subsequent interrupt sources.
So, when RETI is replaced by RET, the program may not fail the first time it is run, but it will fail the second time!
Previous article:Introduction to MCU
Next article:What aspects should be considered in the design of anti-interference measures for single-chip microcomputer systems?
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- 5G filter, duplexer professional design and production
- EEWORLD University ---- Introduction to Linux Kernel Programming
- Share your TouchGFX design and win an STM32F750 development board. Come on board!
- 【GD32E231 DIY】Remote Data Acquisition System
- Force Sensor Selection
- [Gravity:AS7341 Review] Color temperature perception measurement: reading data from four single channels one by one
- CC3200 Kit OURS-SDK-WFB_Exploration 5 - Initial Exploration of WLAN
- Ask about surge protector
- MicroPython's STM branch has been updated with several more updates
- KiCAD 6.01 released