HT45R37V Holtek Semiconductor Inc., HT45R37V Datasheet - Page 15

no-image

HT45R37V

Manufacturer Part Number
HT45R37V
Description
C/r-f Type 8-bit Otp Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
HT45R37V
Manufacturer:
HOLTEK
Quantity:
3 200
Table Program Example
The following example shows how the table pointer and
table data is defined and retrieved from the
microcontroller. This example uses raw table data lo-
cated in the last page which is stored there using the
ORG statement. The value at this ORG statement is
within the 4K Program Memory of the HT45R37. The ta-
ble pointer is setup here to have an initial value of 06H .
This will ensure that the first data read from the data ta-
ble will be at the Program Memory address F06H or 6
locations after the start of the last page. Note that the
value for the table pointer is referenced to the first ad-
dress of the present page if the TABRDC [m] instruc-
tion is being used. 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] in-
struction is executed.
Tempreg1 db
tempreg2 db
mov
mov
tabrdl
dec tblp
tabrdl
org F00h
dc
Rev. 1.00
F00H which refers to the start address of the last page
:
:
:
:
:
:
00Ah, 00Bh, 00Ch, 00Dh, 00Eh, 00Fh, 01Ah, 01Bh
:
:
a,06h
tblp,a
tempreg1
tempreg2
?
?
; temporary register #1
; temporary register #2
; initialise table pointer - note that this address is referenced
; to the last page or present page
; transfers value in table referenced by table pointer
; to tempregl
; data at prog. memory address F06H transferred to
; tempreg1 and TBLH
; reduce value of table pointer by one
; transfers value in table referenced by table pointer
; to tempreg2
; data at prog.memory address F05H transferred to
; tempreg2 and TBLH
; in this example the data 1AH is transferred to
; tempreg1 and data 0FH to register tempreg2
; sets initial address of last page
15
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 table read instructions. If using the table
read instructions, 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
recommended 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.
October 20, 2009
HT45R37V

Related parts for HT45R37V