HT48R063/064/065/066/0662/067
·
Indirect Addressing Program Example
data .section ¢data¢
adres1 db
adres2 db
adres3 db
adres4 db
block
?
?
?
?
db ?
code .section at 0 code
org 00h
start:
mov a,04h
; setup size of block
mov block,a
mov a,offset adres1
mov mp0,a
; Accumulator loaded with first RAM address
; setup memory pointer with first RAM address
loop:
clr IAR0
inc mp0
sdz block
jmp loop
; clear the data at address defined by MP0
; increment memory pointer
; check if last memory location has been cleared
continue:
The important point to note here is that in the example shown above, no reference is made to specific Data Memory
addresses.
Accumulator - ACC
jumps within the current Program Memory page are per-
mitted. When such operations are used, note that a
dummy cycle will be inserted.
The Accumulator is central to the operation of any
microcontroller and is closely related with operations
carried out by the ALU. The Accumulator is the place
where all intermediate results from the ALU are stored.
Without the Accumulator it would be necessary to write
the result of each calculation or logical operation such
as addition, subtraction, shift, etc., to the Data Memory
resulting in higher programming and timing overheads.
Data transfer operations usually involve the temporary
storage function of the Accumulator; for example, when
transferring data between one user defined register and
another, it is necessary to do this by passing the data
through the Accumulator as no direct transfer between
two registers is permitted.
Bank Pointer - BP
In the HT48R0662 and HT48R067 devices, the Data
Memory is divided into two Banks, known as Bank 0 and
Bank 1. ABank Pointer, which is bit 0 of the Bank Pointer
register is used to select the required Data Memory
bank. Only data in Bank 0 can be directly addressed as
data in Bank 1 must be indirectly addressed using Mem-
ory Pointer MP1 and Indirect Addressing Register IAR1.
Using Memory Pointer MP0 and Indirect Addressing
Register IAR0 will always access data from Bank 0, irre-
spective of the value of the Bank Pointer. Memory
Pointer MP1 and Indirect Addressing Register IAR1 can
indirectly address data in either Bank 0 or Bank 1 de-
pending upon the value of the Bank Pointer.
Program Counter Low Register - PCL
To provide additional program control functions, the low
byte of the Program Counter is made accessible to pro-
grammers by locating it within the Special Purpose area
of the Data Memory. By manipulating this register, direct
jumps to other program locations are easily imple-
mented. Loading a value directly into this PCL register
will cause a jump to the specified Program Memory lo-
cation, however, as the register is only 8-bit wide, only
The Data Memory is initialised to Bank 0 after a reset, ex-
cept for the WDT time-out reset in the Idle/Sleep Mode, in
which case, the Data Memory bank remains unaffected.
It should be noted that Special Function Data Memory is
not affected by the bank selection, which means that the
Special Function Registers can be accessed from within
either Bank 0 or Bank 1. Directly addressing the Data
·
BP Register
Bit
Name
R/W
7
6
5
4
3
2
1
0
DMBP0
R/W
0
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
¾
POR
Bit 7~1 :
Bit 0
unimplemented, read as ²0²
DMBP0: Data Memory bank point
0: Bank 0
1: Bank 1
Rev. 1.10
20
June 9, 2009