PIC16C925/926
SWAPF
Syntax:
Operands:
Operation:
Status Affected:
Encoding:
Description:
Words:
Cycles:
Q Cycle Activity:
Swap Nibbles in f
[ label ] SWAPF f [,d]
0 ≤ f ≤ 127
d ∈ [0,1]
(f<3:0>) → (destination<7:4>),
(f<7:4>) → (destination<3:0>)
None
00
1110 dfff ffff
The upper and lower nibbles of reg-
ister ’f’ are exchanged. If ’d’ is 0, the
result is placed in W register. If ’d’ is
1, the result is placed in register ’f’.
1
1
Q1
Q2
Q3
Q4
Decode
Read
register ’f’
Process Write to
data destination
Example
SWAPF REG, 0
Before Instruction:
REG1 = 0xA5
After Instruction:
REG1 = 0xA5
W
= 0x5A
TRIS
Syntax:
Operands:
Operation:
Status Affected:
Encoding:
Description:
Words:
Cycles:
Example
Load TRIS Register
[ label ] TRIS f
5≤f≤7
(W) → TRIS register f;
None
00
0000 0110
0fff
The instruction is supported for
code compatibility with the
PIC16C5X products. Since TRIS
registers are readable and writ-
able, the user can directly address
them.
1
1
To maintain upward compatibil-
ity with future PIC16CXXX
products, do not use this
instruction.
DS39544A-page 130
Preliminary
2001 Microchip Technology Inc.