HT37B90/HT37B70/HT37B50/HT37B30
Program Memory Structure
Look-up Table
Table Program Example
Any location within the Program Memory can be defined
as a look-up table where programmers can store fixed
data. To use the look-up table, the table pointer must
first be setup by placing the address of the look up data
to be retrieved in the three table pointer registers, TBLP,
TBMP and TBHP. This three registers define the ad-
dress of the look-up table. After setting up the table
pointer, the table data can be retrieved from the current
Program Memory or last Program Memory page in the
specific bank which defined by bank point register as
BP1 using the ²TABRDC[m]² or ²TABRDL [m]² instruc-
tions, respectively. When these instructions are exe-
cuted, 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. Any un-
used bits in this transferred higher order byte will have
uncertain values.
The following example shows how the table pointer and
table data is defined and retrieved from the
HT37B90/70/50/30 microcontroller. This example uses
raw table data located in the last page of ROM Bank 1
which is stored there using the ORG and ROMbank
statement. The location at program ROM ²3F00H²
which refers to the start address of the last page within
the Program Memory of the HT37B90/70/50/30
microcontroller. The table pointer is setup here to have
an initial value of ²06H². This will ensure that the first
data read from the data table will be at the Program
Memory address ²3F06H² or 6 locations after the start
of the last page in selected ROMbank. The high byte of
the table data which in this case is equal to zero will be
transferred to the TBLH register automatically when the
²TABRDL [m]² instruction is executed. Because the
TBLH register is a read-only register and cannot be re-
stored, care should be taken to ensure its protection if
both the main routine and Interrupt Service Routine use
table read instructions. If using the table read instruc-
tions, the Interrupt Service Routines may change the
value of the TBLH and subsequently cause errors if
used again by the main routine. As a rule it is recom-
mended that simultaneous use of the table read instruc-
tions should be avoided. However, in situations where
simultaneous use cannot be avoided, the interrupts
should be disabled prior to the execution of any main
routine table-read instructions. Note that all table related
instructions require two instruction cycles to complete
their operation.
The following diagram illustrates the addressing/data
flow of the look-up table:
Rev. 1.00
12
June 22, 2017