Rev. 1.50 28 August 28, 2017 Rev. 1.50 29 August 28, 2017
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
Look-up Table
AnylocationwithintheProgramMemorycanbedenedasalook-uptablewhereprogrammerscan
storexeddata.Tousethelook-uptable,thetablepointermustrstbesetupbyplacingtheaddress
ofthelookupdatatoberetrievedinthetablepointerregister,TBLPandTBHP.Theseregisters
denethetotaladdressofthelook-uptable.
Aftersettingupthetablepointer,thetabledatacanberetrievedfromtheProgramMemoryusing
the“TABRD[m]”or“TABRDL[m]”instructionsrespectively.Whentheinstructionisexecuted,
thelowerordertablebytefromtheProgramMemorywillbetransferredtotheuserdefined
DataMemoryregister[m]asspecifiedintheinstruction.Thehigherordertabledatabytefrom
theProgramMemorywillbetransferredtotheTBLHspecialregister.Anyunusedbitsinthis
transferredhigherorderbytewillbereadas“0”.
Theaccompanyingdiagramillustratestheaddressingdataowofthelook-uptable.
R egister T BLH
User S electe d
R egister
High Byte Low B yte
TBLP R egister
Data
A ddress
16 bits
Last page or
TBHP R egis te r
Table Program Example
Theaccompanyingexampleshowshowthetablepointerandtabledataisdenedandretrievedfrom
thedevice.Thisexampleusesrawtabledatalocatedinthelastpagewhichisstoredthereusingthe
ORGstatement.ThevalueatthisORGstatementis“0F00H”whichreferstothestartaddressofthe
lastpagewithinthe4KProgramMemoryofthedevice.Thetablepointerlowbyteregisterissetup
heretohaveaninitialvalueof“06H”.Thiswillensurethattherstdatareadfromthedatatable
willbeattheProgramMemoryaddress“0F06H”or6locationsafterthestartofthelastpage.Note
thatthevalueforthetablepointerisreferencedtotherstaddressofthepresentpagepointedbythe
TBHPregisterifthe“TABRD[m]”instructionisbeingused.Thehighbyteofthetabledatawhich
inthiscaseisequaltozerowillbetransferredtotheTBLHregisterautomaticallywhenthe“TABRD
[m]instructionisexecuted.
BecausetheTBLHregisterisaread-onlyregisterandcannotberestored,careshouldbetaken
toensureitsprotectionifboththemainroutineandInterruptServiceRoutineusetableread
instructions.Ifusingthetablereadinstructions,theInterruptServiceRoutinesmaychangethe
valueoftheTBLHandsubsequentlycauseerrorsifusedagainbythemainroutine.Asaruleitis
recommendedthatsimultaneoususeofthetablereadinstructionsshouldbeavoided.However,in
situationswheresimultaneoususecannotbeavoided,theinterruptsshouldbedisabledpriortothe
executionofanymainroutinetable-readinstructions.Notethatalltablerelatedinstructionsrequire
twoinstructioncyclestocompletetheiroperation.