Rev. 2.50 260 June 22, 2017 Rev. 2.50 261 June 22, 2017
HT66F20/HT66F30/HT66F40/HT66F50/HT66F60
HT66FU30/HT66FU40/HT66FU50/HT66FU60
A/D Flash MCU with EEPROM
HT66F20/HT66F30/HT66F40/HT66F50/HT66F60
HT66FU30/HT66FU40/HT66FU50/HT66FU60
A/D Flash MCU with EEPROM
Logical and Rotate Operation
ThestandardlogicaloperationssuchasAND,OR,XORandCPLallhavetheirowninstruction
withintheHoltekmicrocontrollerinstructionset.Aswiththecaseofmostinstructionsinvolving
datamanipulation,datamustpassthroughtheAccumulatorwhichmayinvolveadditional
programmingsteps.Inalllogicaldataoperations,thezeroflagmaybesetiftheresultofthe
operationiszero.Anotherformoflogicaldatamanipulationcomesfromtherotateinstructionssuch
asRR,RL,RRCandRLCwhichprovideasimplemeansofrotatingonebitrightorleft.Different
rotateinstructionsexistdependingonprogramrequirements.Rotateinstructionsareusefulforserial
portprogrammingapplicationswheredatacanberotatedfromaninternalregisterintotheCarry
bitfromwhereitcanbeexaminedandthenecessaryserialbitsethighorlow.Anotherapplication
whichrotatedataoperationsareusedistoimplementmultiplicationanddivisioncalculations.
Branches and Control Transfer
ProgrambranchingtakestheformofeitherjumpstospeciedlocationsusingtheJMPinstruction
ortoasubroutineusingtheCALLinstruction.Theydifferinthesensethatinthecaseofa
subroutinecall,theprogrammustreturntotheinstructionimmediatelywhenthesubroutinehas
beencarriedout.Thisisdonebyplacingareturninstruction“RET”inthesubroutinewhichwill
causetheprogramtojumpbacktotheaddressrightaftertheCALLinstruction.InthecaseofaJMP
instruction,theprogramsimplyjumpstothedesiredlocation.Thereisnorequirementtojumpback
totheoriginaljumpingoffpointasinthecaseoftheCALLinstruction.Onespecialandextremely
usefulsetofbranchinstructionsaretheconditionalbranches.Hereadecisionisrstmaderegarding
theconditionofacertaindatamemoryorindividualbits.Dependingupontheconditions,the
programwillcontinuewiththenextinstructionorskipoveritandjumptothefollowinginstruction.
Theseinstructionsarethekeytodecisionmakingandbranchingwithintheprogramperhaps
determinedbytheconditionofcertaininputswitchesorbytheconditionofinternaldatabits.
Bit Operations
TheabilitytoprovidesinglebitoperationsonDataMemoryisanextremelyexiblefeatureofall
Holtekmicrocontrollers.Thisfeatureisespeciallyusefulforoutputportbitprogrammingwhere
individualbitsorportpinscanbedirectlysethighorlowusingeitherthe“SET[m].i”or“CLR[m].i”
instructionsrespectively.Thefeatureremovestheneedforprogrammerstorstreadthe8-bitoutput
port,manipulatetheinputdatatoensurethatotherbitsarenotchangedandthenoutputtheportwith
thecorrectnewdata.Thisread-modify-writeprocessistakencareofautomaticallywhenthesebit
operationinstructionsareused.
Table Read Operations
Datastorageisnormallyimplementedbyusingregisters.However,whenworkingwithlarge
amountsofxeddata,thevolumeinvolvedoftenmakesitinconvenienttostorethexeddatain
theDataMemory.Toovercomethisproblem,HoltekmicrocontrollersallowanareaofProgram
Memorytobesetupasatablewheredatacanbedirectlystored.Asetofeasytouseinstructions
providesthemeansbywhichthisfixeddatacanbereferencedandretrievedfromtheProgram
Memory.
Other Operations
Inadditiontotheabovefunctionalinstructions,arangeofotherinstructionsalsoexistsuchas
the“HALT”instructionforPower-downoperationsandinstructionstocontroltheoperationof
theWatchdogTimerforreliableprogramoperationsunderextremeelectricorelectromagnetic
environments.Fortheirrelevantoperations,refertothefunctionalrelatedsections.