EasyManua.ls Logo

Holtek HT66F002 - Logical and Rotate Operation; Branches and Control Transfer; Bit Operations; Table Read Operations

Default Icon
144 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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
ThestandardlogicaloperationssuchasAND,OR,XORandCPLallhavetheirowninstruction
withintheHoltekmicrocontrollerinstructionset.Aswiththecaseofmostinstructionsinvolving
datamanipulation,datamustpassthroughtheAccumulatorwhichmayinvolveadditional
programmingsteps.Inalllogicaldataoperations,thezeroflagmaybesetiftheresultofthe
operationiszero.Anotherformoflogicaldatamanipulationcomesfromtherotateinstructionssuch
asRR,RL,RRCandRLCwhichprovideasimplemeansofrotatingonebitrightorleft.Different
rotateinstructionsexistdependingonprogramrequirements.Rotateinstructionsareusefulforserial
portprogrammingapplicationswheredatacanberotatedfromaninternalregisterintotheCarry
bitfromwhereitcanbeexaminedandthenecessaryserialbitsethighorlow.Anotherapplication
whichrotatedataoperationsareusedistoimplementmultiplicationanddivisioncalculations.
Branches and Control Transfer
ProgrambranchingtakestheformofeitherjumpstospeciedlocationsusingtheJMPinstruction
ortoasubroutineusingtheCALLinstruction.Theydifferinthesensethatinthecaseofa
subroutinecall,theprogrammustreturntotheinstructionimmediatelywhenthesubroutinehas
beencarriedout.Thisisdonebyplacingareturninstruction"RET"inthesubroutinewhichwill
causetheprogramtojumpbacktotheaddressrightaftertheCALLinstruction.InthecaseofaJMP
instruction,theprogramsimplyjumpstothedesiredlocation.Thereisnorequirementtojumpback
totheoriginaljumpingoffpointasinthecaseoftheCALLinstruction.Onespecialandextremely
usefulsetofbranchinstructionsaretheconditionalbranches.Hereadecisionisrstmaderegarding
theconditionofacertaindatamemoryorindividualbits.Dependingupontheconditions,the
programwillcontinuewiththenextinstructionorskipoveritandjumptothefollowinginstruction.
Theseinstructionsarethekeytodecisionmakingandbranchingwithintheprogramperhaps
determinedbytheconditionofcertaininputswitchesorbytheconditionofinternaldatabits.
Bit Operations
TheabilitytoprovidesinglebitoperationsonDataMemoryisanextremelyexiblefeatureofall
Holtekmicrocontrollers.Thisfeatureisespeciallyusefulforoutputportbitprogrammingwhere
individualbitsorportpinscanbedirectlysethighorlowusingeitherthe"SET[m].i"or"CLR[m].
i"instructionsrespectively.Thefeatureremovestheneedforprogrammerstorstreadthe8-bit
outputport,manipulatetheinputdatatoensurethatotherbitsarenotchangedandthenoutputthe
portwiththecorrectnewdata.Thisread-modify-writeprocessistakencareofautomaticallywhen
thesebitoperationinstructionsareused.
Table Read Operations
Datastorageisnormallyimplementedbyusingregisters.However,whenworkingwithlarge
amountsofxeddata,thevolumeinvolvedoftenmakesitinconvenienttostorethexeddatain
theDataMemory.Toovercomethisproblem,HoltekmicrocontrollersallowanareaofProgram
Memorytobesetasatablewheredatacanbedirectlystored.Asetofeasytouseinstructions
providesthemeansbywhichthisfixeddatacanbereferencedandretrievedfromtheProgram
Memory.
Other Operations
Inadditiontotheabovefunctionalinstructions,arangeofotherinstructionsalsoexistsuchas
the"HALT"instructionforPower-downoperationsandinstructionstocontroltheoperationof
theWatchdogTimerforreliableprogramoperationsunderextremeelectricorelectromagnetic
environments.Fortheirrelevantoperations,refertothefunctionalrelatedsections.

Table of Contents

Related product manuals