Question: Explain the difference between RET and RETI instructions as implemented in 8051 architecture.
0

Subject: Microcontroller and Applications

Topic: 8051 Microcontroller assembly language programing

Difficulty: Low

mca(45) • 2.1k views
ADD COMMENTlink
modified 5 months ago  • written 6 months ago by gravatar for Livia Vaz Livia Vaz0
0

RET is used to return from a subroutine previously called by LCALL or ACALL. Program execution continues at the address that is calculated by the topmost two bytes off the stack. The most-significant-byte is popped off the stack first, followed by the least-significant-byte. Addresses of RET is loaded from the stack.

RETI is used to return from an interrupt service routine. It first enables interrupts of equal and lower priorities to the interrupt that is terminating. Program execution continues at the address that is calculated by the topmost two bytes off the stack. The most-significant-byte is popped off the stack first, followed by the least-significant-byte. RETI addresses is loaded from the stack and the global interrupt flag is set.

RETI functions identically to RET if it is executed outside of an interrupt service routine.

ADD COMMENTlink
written 5 months ago by gravatar for Livia Vaz Livia Vaz0
Please log in to add an answer.