EasyManuals Logo

Intel MCS 51 User Manual

Intel MCS 51
334 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #95 background imageLoading...
Page #95 background image
int&
M~tV-51 PROGRAMMER’SGUIDEANDINSTRUCTIONSET
RET
Function:
Description:
Example:
Bytm
cycles:
Encoding:
Operation:
RETI
Return tlom subroutine
RET popsthe high-and low-orderbytesofthe PC successivelyfromthe staclGdecrementing
the StackPointerbytwo. Programexecutioncontinuesat the resultingaddress,generallythe
instructionimmediatelyfollowingan ACALLor LCALL.No tlagsare affected.
The StackPointeroriginallycontainsthe valueOBH.Internal RAMlocationsOAHand OBH
containthe value-a23Hand OIH, respectively.The instruction,
RET
will leave the Stack Pointer equal to the value 09H. Program executionwill continue at
Ioeation0123H.
1
2
10010100101
RET
(Pc~~-s)+- ((sP))
(SP)+(SP) – 1
(PC74) + ((sP))
(SP)+ (SP) -1
Function:
Description:
Exemple:
Bytes:
Cyclee:
Encoding:
Operation:
Return frominterrupt
RETI popsthe high-and low-orderbytesof the PC successivelyfromthe stack,and reatores
the interrupt logicto accept additional interrupts at the same priority levelas the onejust
processed.The StackPointer is left decrementrdby two. No other registersare aik%sd; the
PSWis notautomaticallyrestored to its pre-interruptstatus. Programexecutioncontinuesat
the resultingaddress,whichis generallythe instructionimmediatelyafter the pointat which
the interrupt requestwas detected.
Ifa lower-or same-levelinterrupt had beenpendingwhen
the RETI instructionis executed, that one instructionwill be executedbeforethe pending
interrupt is processed.
The Stack Pointeroriginallycontainsthe valueOBH.An interrupt was detectedduring the
instruction endingat location 0122H.Internal RAM locations OAHand OBHcontain the
values23HandOIH,reapeotively.The instruction,
RETI
wiltleavethe StackPointer equat to O$IHand return programexecutionto locationO123H.
1
2
10011 I 00101
(PCls.s)+ ((sP))
(sP)+ (SP) -1
(PC74) + ((sP))
(SP) -(SP) -1
2-65

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Intel MCS 51 and is the answer not in the manual?

Intel MCS 51 Specifications

General IconGeneral
BrandIntel
ModelMCS 51
CategoryMicrocontrollers
LanguageEnglish

Related product manuals