Rev. 1.71 122 April 11, 2017 Rev. 1.71 123 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
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-bit
outputport,manipulatetheinputdatatoensurethatotherbitsarenotchangedandthenoutputthe
portwiththecorrectnewdata.Thisread-modify-writeprocessistakencareofautomaticallywhen
thesebitoperationinstructionsareused.
Table Read Operations
Datastorageisnormallyimplementedbyusingregisters.However,whenworkingwithlarge
amountsofxeddata,thevolumeinvolvedoftenmakesitinconvenienttostorethexeddatain
theDataMemory.Toovercomethisproblem,HoltekmicrocontrollersallowanareaofProgram
Memorytobesetasatablewheredatacanbedirectlystored.Asetofeasytouseinstructions
providesthemeansbywhichthisfixeddatacanbereferencedandretrievedfromtheProgram
Memory.
Other Operations
Inadditiontotheabovefunctionalinstructions,arangeofotherinstructionsalsoexistsuchas
the"HALT"instructionforPower-downoperationsandinstructionstocontroltheoperationof
theWatchdogTimerforreliableprogramoperationsunderextremeelectricorelectromagnetic
environments.Fortheirrelevantoperations,refertothefunctionalrelatedsections.