For the HT48RU80/HT48CU80 devices, there are two Table Pointer Registers known as TBLP
and TBHP in which the lower order and higher order address of the look-up data to be retrieved
must be respectively first written. Unlike the other devices in which only the low address byte is de
-
fined using the TBLP register, the additional TBHP register allows the complete address of the
look-up table to be defined and consequently allow table data from any address and any page to
be directly accessed. For these devices, after setting up both the low and high byte table pointers,
the table data can then be retrieved from any area of Program Memory using the ²TABRDC [m]² in
-
struction or from the last page of the current Program Memory Bank using the ²TABRDL [m]² in
-
struction. When either of these instructions are executed, the lower order table byte from the
Program Memory will be transferred to the user defined Data Memory register [m] as specified in
the instruction. The higher order table data byte from the Program Memory will be transferred to
the TBLH special register.
The following diagram illustrates the addressing/data flow of the look-up table for the
HT48RU80/HT48CU80 devices:
The following example shows how the table pointer is defined and table data retrieved from the
HT48RU80/HT48CU80 devices. This example uses raw table data which is located and stored in
the Program Memory using the ORG statement. The value at this ORG statement is ²000H², how-
ever, this only indicates the offset value from the start address of Bank 1 which in this case is
²2000H². The table pointer high byte is setup to have a value of ²20H² while the value of the table
pointer low byte is setup here to have an initial value of ²05H². This will ensure that the data byte
read from the data table will be located at the Program Memory address ²2005H² or 5 locations af-
ter the first address defined by the ORG statement. When the ²TABRDC [m]² instruction is exe-
cuted, the table data low byte which has a value of ²FFH², will be transferred to the user defined
temp register, while the table data high byte, which has a value of ²55H², will be transferred to the
TBLH register.
include HT48RU80.inc
:
:
data .section ¢data¢
temp db ?
:
:
rombank 0 codesec0 ; Bank 0 definition
rombank 1 codesec1 ; Bank 1 definition
:
:
codesec0 .section at 0 ¢code¢
jmp start
:
26
I/O Type MCU
P r o g r a m
M e m o r y
T B L P
T B L H S p e c i f i e d b y [ m ]
H i g h b y t e o f t a b l e c o n t e n t s
L o w b y t e o f t a b l e c o n t e n t s
T B H P