PIC16C71X
RETLW
Return with Literal in W
RETURN
Return from Subroutine
[ label ] RETURN
None
Syntax:
[ label ] RETLW k
Syntax:
Operands:
Operation:
0 ≤ k ≤ 255
Operands:
Operation:
Status Affected:
Encoding:
Description:
k → (W);
TOS → PC
TOS → PC
None
Status Affected:
Encoding:
None
00
0000
0000
1000
11
01xx
kkkk
kkkk
Return from subroutine. The stack is
POPed and the top of the stack (TOS)
is loaded into the program counter.
This is a two cycle instruction.
The W register is loaded with the eight
bit literal 'k'. The program counter is
loaded from the top of the stack (the
return address). This is a two cycle
instruction.
Description:
Words:
1
2
Cycles:
Words:
1
2
Q Cycle Activity:
1st Cycle
Q1
Q2
Q3
Q4
Cycles:
Decode
NOP
NOP
Pop from
the Stack
Q Cycle Activity:
1st Cycle
Q1
Q2
Q3
Q4
Decode
Read
NOP
Write to
W, Pop
from the
Stack
NOP
NOP
NOP
NOP
2nd Cycle
Example
literal 'k'
RETURN
NOP
NOP
NOP
NOP
2nd Cycle
Example
After Interrupt
PC
=
TOS
CALL TABLE ;W contains table
;offset value
•
;W now has table value
•
•
TABLE
ADDWF PC
RETLW k1
RETLW k2
•
;W = offset
;Begin table
;
•
•
RETLW kn
; End of table
Before Instruction
W
=
0x07
After Instruction
W
=
value of k8
DS30272A-page 80
1997 Microchip Technology Inc.