HT82A850R
Rev. 1.10
7
July 25, 2007
Program Memory
The program memory is used to store the executable
program instructions. It also contains data, table, and in-
terrupt entries, and is organized into 4096 15 bits, ad-
dressed by the program counter and table pointer.
Certain locations in the program memory are reserved
for special usage:
Location 000H
This location is reserved for program initialisation. Af-
ter a device reset, the program always begins execu-
tion at location 000H.
Location 008H
This location is reserved for the Timer/Event Counter
0 interrupt service program. If a timer interrupt results
from a Timer/Event Counter 0 overflow, and if the in-
terrupt is enabled and the stack is not full, the program
will jump to this location and begin execution.
Location 00CH
This location is reserved for the Timer/Event Counter
1 interrupt service program. If a timer interrupt results
from a Timer/Event Counter 1 overflow, and the inter-
rupt is enabled and the stack is not full, the program
will jump to this location and begin execution.
Location 010H
This location is reserved for the play interrupt service
program. If the play data is valid, and the interrupt is
enabled and the stack is not full, the program will jump
to this location and begin execution.
Location 014H
This location is reserved for when 8 bits of data have
been received or transmitted successful from the se-
rial interface. If the related interrupts are enabled, and
the stack is not full, the program will jump to this loca-
tion and begin execution.
Location 018H
This location is reserved for the record interrupt ser-
vice program. If the record data valid, the interrupt is
enabled and the stack is not full, the program will jump
to this location and begin execution.
Table location
Any location in the program memory can be used as a
look-up table. There are three method to read the pro-
gram memory data. The first method uses the
TABRDC instruction to transfer the contents of the
current page lower-order byte to the specified data
memory, and the current page higher-order byte to the
TBLH register. The second method uses the TABRDL
instruction to transfer the contents of the last page
lower-order byte to the specified data memory, and
the last page higher-order byte to the TBLH register.
The third method uses the TABRDC instruction to-
gether with the TBLP and TBHP pointers to transfer
the contents of the lower order byte at the specified
address to the specified data memory, and the higher
order byte at the specified address to the TBLH regis-
ter. Before accessing the table data, the address to be
read must be placed in the table pointer registers,
TBLP and TBHP. Note that if the configuration option
TBHP is disabled, then the value in TBHP has no ef-
fect. Only the destination of the lower-order byte in the
table is well-defined, the other bits of the table word
are transferred to the lower portion of TBLH, and the
remaining 1-bit word is read as
Higher-order byte register, TBLH, is read only. The
TBLH register is read only and cannot be restored. If
the main routine and the ISR (Interrupt Service Rou-
tine) both employ the table read instruction, the con-
tents of TBLH in the main routine are likely to be
changed by the table read instruction used in the ISR.
In such cases errors can occur. Therefore, using the
table read instruction in the main routine and the ISR
simultaneously should be avoided. However, if the ta-
ble read instruction has to be used in both the main
routine and the ISR, the interrupt should be disabled
0 .The Table
B % %
% #
% ) %
% 8
) ) > C
2
%
& D
%
) ) - C
( ' 2
%
% )
%
5
%
% /
2
( ' 2
%
%
%
5
%
&
%
%
5
& %
#
%
%
5
%
%
5
) ) ) C
) )
C
)
) C
)
- C
)
> C
) . ) C
8 8 8 C
)
/ C
Program Memory
Instruction
Table Location
*11
*10
*9
*8
*7
*6
*5
*4
*3
*2
*1
*0
TABRDC [m]
P11
P10
P9
P8
@7
@6
@5
@4
@3
@2
@1
@0
TABRDL [m]
1
1
1
1
@7
@6
@5
@4
@3
@2
@1
@0
Table Location
Note: *11~*0: Table location bits
@7~@0: Table pointer bits
P11~P8: Current program counter bits when TBHP is disabled
TBHP register bit3~bit0 when TBHP is enabled