i~.
MCS@-51PROGRAMMER’SGUIDE AND INSTRUCTION SET
SJMP rel
Function:
Deaoription:
Example:
Bytes:
Cycles:
Encoding:
Operation:
ShortJurnP
Programcontrolbranchss unconditionallyto the addressindicated.Thebranch destinationis
computedby addingthe signeddisplacementin the secondinstructionbyteto the PC, after
incrementingthe PC twice. Therefore,the range of destinationsallowedis from 128bytes
precedingthis instructionto 127bytesfollowingit.
The label“RELADR” is assignedto an instructionat programmemorylocation0123H.The
instruction,
SJMP RELADR
willassembleinto locationO1OOH.After the instructionis executed,the PC willccmti the
value0123H.
(NorcUnderthe aboveconditionstheinstructionfollowingSJMPwillbeat 102H.Therefore,
the displacementbyteofthe instructionwillbe the relativeoffset(O123H-O1O2H)= 21H.Put
anotherway,an SJMPwith a displacementofOFEHwouldbe a one-instructioninfiniteloop.)
2
2
1000
100”01 EEl
SJMP
(PC)+ (PC) +
2
(PC) - (PC) + rel
2-69