Home > Common Problem > What is the last instruction in the interrupt service routine?

What is the last instruction in the interrupt service routine?

青灯夜游
Release: 2023-01-13 00:31:25
Original
18698 people have browsed it

The last instruction of the interrupt service routine must be: RETI, which is the interrupt return instruction, and is only used at the end of the interrupt service routine. After the interrupt program is completed, a RETI instruction must be executed. After executing this instruction, the CPU will take out the address saved in the stack and send it back to the PC. Then the program will continue execution from the interruption point of the main program.

What is the last instruction in the interrupt service routine?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

The last instruction of the interrupt service routine must be: RETI.

RETI is the interrupt return instruction

The function of this instruction is similar to the RET instruction. The difference between the two instructions is: when this instruction clears the interrupt response, it is set to 1 The MCS-51 internal non-addressable "Priority Valid" flip-flop is cleared.

After the interrupt program is completed, a RETI instruction must be executed. After executing this instruction, the CPU will take out the address saved in the stack and send it back to the PC. Then the program will start from the interruption point of the main program. Continue to execute. The interrupt instruction "RETI" is an interrupt jump-out instruction. In addition to taking out the address saved in the stack and sending it back to the PC, so that the program can continue execution from the interruption point of the main program, it also has the function of "priority taking effect" trigger. Clear function.

For more knowledge about computer programming, please visit: Programming Video! !

The above is the detailed content of What is the last instruction in the interrupt service routine?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template