PIC18FXX20
TBLWT
Table Write
TBLWT Table Write (Continued)
Syntax:
[ label ] TBLWT ( *; *+; *-; +*)
Words: 1
Operands:
Operation:
None
if TBLWT*,
Cycles: 2
Q Cycle Activity:
(TABLAT) → Holding Register;
TBLPTR - No Change;
if TBLWT*+,
Q1
Decode
Q2
No
operation
Q3
No
operation
Q4
No
operation
(TABLAT) → Holding Register;
(TBLPTR) +1 → TBLPTR;
if TBLWT*-,
No
operation
No
No
operation
No
operation
(Read
operation
(Write to
Holding
Register )
(TABLAT) → Holding Register;
(TBLPTR) -1 → TBLPTR;
if TBLWT+*,
TABLAT)
(TBLPTR) +1 → TBLPTR;
(TABLAT) → Holding Register;
Example1:
TBLWT *+;
Status Affected: None
Encoding:
Before Instruction
0000
0000
0000
11nn
nn=0 *
=1 *+
=2 *-
=3 +*
TABLAT
TBLPTR
=
=
0x55
0x00A356
HOLDING REGISTER
(0x00A356)
=
0xFF
After Instructions (table write completion)
TABLAT
=
=
0x55
Description:
This instruction uses the 3 LSBs of
TBLPTR to determine which of the 8
holding registers the TABLAT is writ-
ten to. The holding registers are used
to program the contents of Program
Memory (P.M.). (Refer to Section 5.0
for additional details on programming
FLASH memory.)
The TBLPTR (a 21-bit pointer) points
to each byte in the program memory.
TBLPTR has a 2-MByte address
range. The LSb of the TBLPTR
selects which byte of the program
memory location to access.
TBLPTR
0x00A357
HOLDING REGISTER
(0x00A356)
=
0x55
Example 2:
TBLWT +*;
Before Instruction
TABLAT
=
=
0x34
TBLPTR
0x01389A
HOLDING REGISTER
(0x01389A)
=
0xFF
0xFF
HOLDING REGISTER
(0x01389B)
=
After Instruction (table write completion)
TABLAT
=
=
0x34
TBLPTR
0x01389B
HOLDING REGISTER
(0x01389A)
=
=
0xFF
0x34
TBLPTR[0] = 0:Least Significant
HOLDING REGISTER
(0x01389B)
Byte of Program
Memory Word
TBLPTR[0] = 1:Most Significant
Byte of Program
Memory Word
The TBLWT instruction can modify
the value of TBLPTR as follows:
• no change
• post-increment
• post-decrement
• pre-increment
DS39609A-page 298
Advance Information
2003 Microchip Technology Inc.