HT45F12
8-Bit Flash MCU with Op Amps & Comparators
Special Function Register Description
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.
Indirect Addressing Registers – IAR0, IAR1
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ꢀBank0ꢀ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.
Memory Pointers – MP0, MP1
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.
TheꢀfollowingꢀexampleꢀshowsꢀhowꢀtoꢀclearꢀaꢀsectionꢀofꢀfourꢀDataꢀMemoryꢀlocationsꢀalreadyꢀdefinedꢀ
asꢀlocationsꢀadres1ꢀtoꢀadres4.
Indirect Addressing Program Example
data .section ´data´
adres1
db ?
db ?
adres2 db ?
adres3 db ?
adres4 db ?
block
code .section at 0 ´code´
org00h
start:
mov a,04h
; setup size of block
mov block,a
mov a,offset adres1 ; Accumulator loaded with first RAM address
mov mp0,a
; setup memory pointer with first RAM address
loop:
clr IAR0
inc mp0
; clear the data at address defined by mp0
; increment memory pointer
sdz block
jmp loop
; 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.
Rev. 0.00
ꢄ5
�eꢀteꢁꢂeꢃ ꢄꢅꢆ ꢄ01ꢄ