Rev. 1.71 28 April 11, 2017 Rev. 1.71 29 April 11, 2017
HT66F002/HT66F0025/HT66F003/HT66F004
Cost-Effective A/D Flash MCU with EEPROM
HT66F002/HT66F0025/HT66F003/HT66F004
Cost-Effective A/D Flash MCU with EEPROM
Special Function Register Description
MostoftheSpecialFunctionRegisterdetailswillbedescribedintherelevantfunctionalsection,
howeverseveralregistersrequireaseparatedescriptioninthissection.
Indirect Addressing Registers – IAR0, IAR1
TheIndirectAddressingRegisters,IAR0andIAR1,althoughhavingtheirlocationsinnormalRAM
registerspace,donotactuallyphysicallyexistasnormalregisters.Themethodofindirectaddressing
forRAMdatamanipulationusestheseIndirectAddressingRegistersandMemoryPointers,in
contrasttodirectmemoryaddressing,wheretheactualmemoryaddressisspecied.Actionsonthe
IAR0andIAR1registerswillresultinnoactualreadorwriteoperationtotheseregistersbutrather
tothememorylocationspeciedbytheircorrespondingMemoryPointers,MP0orMP1.Actingasa
pair,IAR0andMP0cantogetheraccessdatafromBank0whiletheIAR1andMP1registerpaircan
accessdatafromanybank.AstheIndirectAddressingRegistersarenotphysicallyimplemented,
readingtheIndirectAddressingRegistersindirectlywillreturnaresultof“00H”andwritingtothe
registersindirectlywillresultinnooperation.
Memory Pointers – MP0, MP1
TwoMemoryPointers,knownasMP0andMP1areprovided.TheseMemoryPointersare
physicallyimplementedintheDataMemoryandcanbemanipulatedinthesamewayasnormal
registersprovidingaconvenientwaywithwhichtoaddressandtrackdata.Whenanyoperationto
therelevantIndirectAddressingRegistersiscarriedout,theactualaddressthatthemicrocontroller
isdirectedtoistheaddressspeciedbytherelatedMemoryPointer.MP0,togetherwithIndirect
AddressingRegister,IAR0,areusedtoaccessdatafromBank0,whileMP1andIAR1areusedto
accessdatafromallbanksaccordingtoBPregister.DirectAddressingcanonlybeusedwithBank0,
allotherBanksmustbeaddressedindirectlyusingMP1andIAR1.
ThefollowingexampleshowshowtoclearasectionoffourDataMemorylocationsalreadydened
aslocationsadres1toadres4.
Indirect Addressing Program Example
data .section ´data´
adres1 db ?
adres2 db ?
adres3 db ?
adres4 db ?
block db ?
code .section at 0 ´code´
org00h
start:
mov a,04h ; setup size of block
mov block,a
mov a,offset adres1 ; Accumulator loaded with rst RAM address
mov mp0,a ; setup memory pointer with rst RAM address
loop:
clr IAR0 ; clear the data at address dened by mp0
inc mp0 ; increment memory pointer
sdz block ; check if last memory location has been cleared
jmp loop
continue:
Theimportantpointtonotehereisthatintheexampleshownabove,noreferenceismadetospecic
DataMemoryaddresses.