BS85B12-3 HOLTEK [Holtek Semiconductor Inc], BS85B12-3 Datasheet - Page 29

no-image

BS85B12-3

Manufacturer Part Number
BS85B12-3
Description
Touch Key Flash Type 8-Bit MCU with LCD/LED Driver
Manufacturer
HOLTEK [Holtek Semiconductor Inc]
Datasheet
BS85B12-3/BS85C20-3
Touch Key Flash MCU with LCD/LED Driver
Special Function Register Description
Rev. 1.00
Indirect Addressing Registers - IAR0, IAR1
Memory Pointers - MP0, MP1
Indirect Addressing Program Example
Most of the Special Function Register details will be described in the relevant functional section,
however several registers require a separate description in this section.
The Indirect Addressing Registers, IAR0 and IAR1, although having their locations in normal RAM
register space, do not actually physically exist as normal registers. The method of indirect addressing
for RAM data manipulation uses these Indirect Addressing Registers and Memory Pointers, in
contrast to direct memory addressing, where the actual memory address is specified. Actions on the
IAR0 and IAR1 registers will result in no actual read or write operation to these registers but rather to
the memory location specified by their corresponding Memory Pointers, MP0 or MP1. Acting as a
pair, IAR0 and MP0 can together access data from Bank 0 while the IAR1 and MP1 register pair can
access data from any bank. As the Indirect Addressing Registers are not physically implemented,
reading the Indirect Addressing Registers indirectly will return a result of 00H and writing to the
registers indirectly will result in no operation.
Two Memory Pointers, known as MP0 and MP1 are provided. These Memory Pointers are physically
implemented in the Data Memory and can be manipulated in the same way as normal registers
providing a convenient way with which to address and track data. When any operation to the relevant
Indirect Addressing Registers is carried out, the actual address that the microcontroller is directed to, is
the address specified by the related Memory Pointer. MP0, together with Indirect Addressing Register,
IAR0, are used to access data from Bank 0, while MP1 and IAR1 are used to access data from all banks
according to BP register. Direct Addressing can only be used with Bank 0, all other Banks must be
addressed indirectly using MP1 and IAR1. Note that for this series of devices, the Memory Pointers,
MP0 and MP1, are both 8-bit registers and used to access the Data Memory together with their
corresponding indirect addressing registers IAR0 and IAR1.
The following example shows how to clear a section of four Data Memory locations already defined as
locations adres1 to adres4.
data .section data
adres1
adres2
adres3
adres4
block
code .section at 0 code
org 00h
start:
loop:
continue:
The important point to note here is that in the example shown above, no reference is made to specific
RAM addresses.
mov a,04h
mov block,a
mov a,offset adres1
mov mp0,a
clr IAR0
inc mp0
sdz block
jmp loop
db ?
db ?
db ?
db ?
db ?
; setup size of block
; Accumulator loaded with first RAM address
; setup memory pointer with first RAM address
; clear the data at address defined by MP0
; increment memory pointer
; check if last memory location has been cleared
23
February 1, 2011

Related parts for BS85B12-3