Datasheet
PIC16C71X
DS30272A-page 80 1997 Microchip Technology Inc.
RETLW Return with Literal in W
Syntax: [
label
] RETLW k
Operands: 0 ≤ k ≤ 255
Operation: k → (W);
TOS → PC
Status Affected: None
Encoding:
11 01xx kkkk kkkk
Description:
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.
Words: 1
Cycles: 2
Q Cycle Activity: Q1 Q2 Q3 Q4
1st Cycle
Decode Read
literal 'k'
NOP Write to
W, Pop
from the
Stack
2nd Cycle
NOP NOP NOP NOP
Example
TABLE
CALL TABLE ;W contains table
;offset value
• ;W now has table value
•
•
ADDWF PC ;W = offset
RETLW k1 ;Begin table
RETLW k2 ;
•
•
•
RETLW kn ; End of table
Before Instruction
W = 0x07
After Instruction
W = value of k8
RETURN Return from Subroutine
Syntax: [
label
] RETURN
Operands: None
Operation: TOS → PC
Status Affected: None
Encoding:
00 0000 0000 1000
Description:
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.
Words: 1
Cycles: 2
Q Cycle Activity: Q1 Q2 Q3 Q4
1st Cycle
Decode NOP NOP Pop from
the Stack
2nd Cycle
NOP NOP NOP NOP
Example
RETURN
After Interrupt
PC = TOS