ht82a836r Holtek Semiconductor Inc., ht82a836r Datasheet - Page 10

no-image

ht82a836r

Manufacturer Part Number
ht82a836r
Description
Usb Audio Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
HT82A836R
Manufacturer:
HOLTEK/合泰
Quantity:
20 000
Look-up Table
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 pointers must
first be setup which point to the data in the Program
Memory which is to be read. In this device there are two
table pointers, the low byte pointer, TBLP and the high
byte pointer, TBHP. However, the high byte pointer,
TBHP, can only be used if it is enabled using configura-
tion options. Using both table pointers enables any area
in the Program Memory to be addressed while if only the
low byte pointer, TBLP, is used then only the present
page or last page can be addressed.
If the configuration options do not enable the high byte
pointer, then after setting up the low table pointer, TBLP,
the table data can be retrieved from the current Program
Memory page or last Program Memory page using the
tively. When these instructions are executed, the lower
order table byte from the Program Memory will be trans-
ferred 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 using the single table address
pointer TBLP:
If the configuration options enable the high table pointer,
TBHP, then this register together with the low table
pointer, TBLP, can be used together as a pair to point to
any located in the Program Memory. 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] instruction or from the last
page of the Program Memory using the TABRDL [m]
instruction. When either of 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.
Rev. 1.00
TABRDC[m] or TABRDL [m] instructions, respec-
Single Address Pointer Look-up Table
10
The following diagram illustrates the addressing/data
flow of the look-up table using the dual table address
pointers TBLP and TBHP:
Table Program Example
The following example shows how the table pointer and
table data is defined and retrieved from the micro con-
troller using the single table data pointer, TBLP. This ex-
ample uses raw table data located in the last page which
is stored there using the ORG statement. The value at
this ORG statement is 1F00H which refers to the start
address of the last page within the 8K Program Memory
of device. The table pointer is setup here to have an ini-
tial value of 06H . This will ensure that the first data
read from the data table will be at the Program Memory
address 1F06H or 6locations after the start of the last
page. Note that the value for the table pointer is refer-
enced to the first address of the present page if the
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 restored, care should be taken to ensure its
protection if both the main routine and Interrupt Service
Routine use the table read instructions. If using the table
read instructions, the Interrupt Service Routines may
change the value of TBLH and subsequently cause er-
rors if used again by the main routine. As a rule it is rec-
ommended that simultaneous use of the table read
instructions should be avoided. However, in situations
where simultaneous use cannot be avoided, the inter-
rupts 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.
TABRDC [m] instruction is being used. The high byte
Dual Address Pointer Look-up Table
HT82A836R
March 20, 2008

Related parts for ht82a836r