PIC17C4X
SWAPF
Syntax:
Swap f
TABLRD
Syntax:
Table Read
[ label ] SWAPF f,d
[ label ] TABLRD t,i,f
Operands:
0 ≤ f ≤ 255
Operands:
0 ≤ f ≤ 255
d
[0,1]
i
t
[0,1]
[0,1]
Operation:
f<3:0> → dest<7:4>;
f<7:4> → dest<3:0>
Operation:
If t = 1,
TBLATH → f;
If t = 0,
TBLATL → f;
Prog Mem (TBLPTR) → TBLAT;
If i = 1,
TBLPTR + 1 → TBLPTR
Status Affected:
Encoding:
None
0001
110d
ffff
ffff
The upper and lower nibbles of register
'f' are exchanged. If 'd' is 0 the result is
placed in WREG. If 'd' is 1 the result is
placed in register 'f'.
Description:
Status Affected:
Encoding:
None
Words:
Cycles:
1
1
1010
10ti
ffff
ffff
1. A byte of the table latch (TBLAT)
is moved to register file 'f'.
Description:
Q Cycle Activity:
Q1
If t = 0: the high byte is moved;
If t = 1: the low byte is moved
Q2
Q3
Q4
Decode
Read
Execute
Write to
2. Then the contents of the program
memory location pointed to by
register 'f'
destination
SWAPF
REG,
0
Example:
the
16-bit
Table
Pointer
(TBLPTR) is loaded into the
16-bit Table Latch (TBLAT).
Before Instruction
REG
=
0x53
0x35
3. If i = 1: TBLPTR is incremented;
If i = 0: TBLPTR is not
incremented
After Instruction
REG
=
Words:
Cycles:
1
2 (3 cycle if f = PCL)
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register
Execute
Write
register 'f'
TBLATH or
TBLATL
1996 Microchip Technology Inc.
DS30412C-page 137