|
PIC16F8X_13 Datasheet, PDF (66/128 Pages) Microchip Technology – 18-pin Flash/EEPROM 8-Bit Microcontrollers | |||
|
◁ |
PIC16F8X
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'
No-Opera
tion
Write to
W, Pop
from the
Stack
2nd Cycle
No-Opera No-Opera No-Operat
No-Operat tion
tion
ion
ion
Example
CALL TABLE ;W contains table
â¢
â¢
â¢
TABLE ADDWF PC
;offset value
;W now has table value
;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 No-Opera No-Opera Pop from
tion
tion the Stack
2nd Cycle
No-Opera No-Opera No-Opera
No-Operat tion
tion
tion
ion
Example
RETURN
After Interrupt
PC = TOS
DS30430D-page 66
ï£ 1996-2013 Microchip Technology Inc.
|
▷ |