HT45F12
8-Bit Flash MCU with Op Amps & Comparators
P
o
r
r
g
m
a
M
m
e
r
o
y
L
a
t
s
p
g
o
r
e
T
H
B
P
R
e
s
g
e
t
i
r
D
t
a
a
1
5
b
i
s
t
T
L
B
P
R
e
i
g
t
s
r
e
U
e
s
r
S
e
e
l
t
c
d
e
R
g
e
s
i
e
t
r
T
B
H
L
R
g
e
s
i
e
t
r
H
g
i
h
B
y
e
t
o
L
w
B
y
e
t
Table location
Instruction
b9
TABRDC [ꢁ] PC9
TABRDL [ꢁ]
b8
b7
b6
b5
@5
@5
b4
@4
@4
b3
b2
@ꢄ
@ꢄ
b1
@1
@1
b0
@0
@0
PC8
1
@7
@7
@ꢅ
@ꢅ
@3
@3
1
Table Location
Note:ꢀb9~b0:ꢀTableꢀlocationꢀbits
PC9~PC8:ꢀCurrentꢀProgramꢀCounterꢀbits
@7~@0:ꢀTableꢀPointerꢀTBLPꢀbits
Table Program Example
Theꢀfollowingꢀexampleꢀshowsꢀhowꢀtheꢀtableꢀpointerꢀandꢀtableꢀdataꢀisꢀdefinedꢀandꢀretrievedꢀfromꢀtheꢀ
microcontroller.ꢀThisꢀexampleꢀusesꢀrawꢀtableꢀdataꢀlocatedꢀinꢀtheꢀProgramꢀMemoryꢀwhichꢀisꢀstoredꢀ
thereꢀusingꢀtheꢀORGꢀstatement.ꢀTheꢀvalueꢀatꢀthisꢀORGꢀstatementꢀisꢀ“300H”ꢀwhichꢀrefersꢀtoꢀtheꢀstartꢀ
addressꢀofꢀtheꢀlastꢀpageꢀwithinꢀtheꢀ1KꢀwordsꢀProgramꢀMemoryꢀofꢀtheꢀdevice.ꢀTheꢀtableꢀpointerꢀisꢀ
setupꢀhereꢀtoꢀhaveꢀanꢀinitialꢀvalueꢀofꢀ“06H”.ꢀThisꢀwillꢀensureꢀthatꢀtheꢀfirstꢀdataꢀreadꢀfromꢀtheꢀdataꢀ
tableꢀwillꢀbeꢀatꢀtheꢀProgramꢀMemoryꢀaddressꢀ“306H”ꢀorꢀ6ꢀlocationsꢀafterꢀtheꢀstartꢀofꢀtheꢀlastꢀpage.ꢀ
Noteꢀthatꢀtheꢀvalueꢀforꢀtheꢀtableꢀpointerꢀisꢀreferencedꢀtoꢀtheꢀfirstꢀaddressꢀofꢀtheꢀpresentꢀpageꢀifꢀtheꢀ
“TABRDCꢀ[m]”ꢀinstructionꢀisꢀbeingꢀused.ꢀTheꢀhighꢀbyteꢀofꢀtheꢀtableꢀdataꢀwhichꢀinꢀthisꢀcaseꢀisꢀequalꢀ
toꢀzeroꢀwillꢀbeꢀtransferredꢀtoꢀtheꢀTBLHꢀregisterꢀautomaticallyꢀwhenꢀtheꢀ“TABRDLꢀ[m]”ꢀinstructionꢀ
isꢀexecuted.
BecauseꢀtheꢀTBLHꢀregisterꢀisꢀaꢀread-onlyꢀregisterꢀandꢀcannotꢀbeꢀrestored,ꢀcareꢀshouldꢀbeꢀtakenꢀ
toꢀensureꢀitsꢀprotectionꢀifꢀbothꢀtheꢀmainꢀroutineꢀandꢀInterruptꢀServiceꢀRoutineꢀuseꢀtableꢀreadꢀ
instructions.ꢀIfꢀusingꢀtheꢀtableꢀreadꢀinstructions,ꢀtheꢀInterruptꢀServiceꢀRoutinesꢀmayꢀchangeꢀtheꢀ
valueꢀofꢀtheꢀTBLHꢀandꢀsubsequentlyꢀcauseꢀerrorsꢀifꢀusedꢀagainꢀbyꢀtheꢀmainꢀroutine.ꢀAsꢀaꢀruleꢀitꢀisꢀ
recommendedꢀthatꢀsimultaneousꢀuseꢀofꢀtheꢀtableꢀreadꢀinstructionsꢀshouldꢀbeꢀavoided.ꢀHowever,ꢀinꢀ
situationsꢀwhereꢀsimultaneousꢀuseꢀcannotꢀbeꢀavoided,ꢀtheꢀinterruptsꢀshouldꢀbeꢀdisabledꢀpriorꢀtoꢀtheꢀ
executionꢀofꢀanyꢀmainꢀroutineꢀtable-readꢀinstructions.ꢀNoteꢀthatꢀallꢀtableꢀrelatedꢀinstructionsꢀrequireꢀ
twoꢀinstructionꢀcyclesꢀtoꢀcompleteꢀtheirꢀoperation.
Rev. 0.00
ꢄ1
�eꢀteꢁꢂeꢃ ꢄꢅꢆ ꢄ01ꢄ