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
Instruction Set
Introduction
Centraltothesuccessfuloperationofanymicrocontrollerisitsinstructionset,whichisasetof
programinstructioncodesthatdirectsthemicrocontrollertoperformcertainoperations.Inthecase
ofHoltekmicrocontroller,acomprehensiveandexiblesetofover60instructionsisprovidedto
enableprogrammerstoimplementtheirapplicationwiththeminimumofprogrammingoverheads.
Foreasierunderstandingofthevariousinstructioncodes,theyhavebeensubdividedintoseveral
functionalgroupings.
Instruction Timing
Mostinstructionsareimplementedwithinoneinstructioncycle.Theexceptionstothisarebranch,
call,ortablereadinstructionswheretwoinstructioncyclesarerequired.Oneinstructioncycleis
equalto4systemclockcycles,thereforeinthecaseofan8MHzsystemoscillator,mostinstructions
wouldbeimplementedwithin0.5μsandbranchorcallinstructionswouldbeimplementedwithin
1μs.Althoughinstructionswhichrequireonemorecycletoimplementaregenerallylimitedto
theJMP,CALL,RET,RETIandtablereadinstructions,itisimportanttorealizethatanyother
instructionswhichinvolvemanipulationoftheProgramCounterLowregisterorPCLwillalsotake
onemorecycletoimplement.AsinstructionswhichchangethecontentsofthePCLwillimplya
directjumptothatnewaddress,onemorecyclewillberequired.Examplesofsuchinstructions
wouldbe"CLRPCL"or"MOVPCL,A".Forthecaseofskipinstructions,itmustbenotedthatif
theresultofthecomparisoninvolvesaskipoperationthenthiswillalsotakeonemorecycle,ifno
skipisinvolvedthenonlyonecycleisrequired.
Moving and Transferring Data
Thetransferofdatawithinthemicrocontrollerprogramisoneofthemostfrequentlyused
operations.MakinguseofthreekindsofMOVinstructions,datacanbetransferredfromregistersto
theAccumulatorandvice-versaaswellasbeingabletomovespecicimmediatedatadirectlyinto
theAccumulator.Oneofthemostimportantdatatransferapplicationsistoreceivedatafromthe
inputportsandtransferdatatotheoutputports.
Arithmetic Operations
Theabilitytoperformcertainarithmeticoperationsanddatamanipulationisanecessaryfeatureof
mostmicrocontrollerapplications.WithintheHoltekmicrocontrollerinstructionsetarearangeof
addandsubtractinstructionmnemonicstoenablethenecessaryarithmetictobecarriedout.Care
mustbetakentoensurecorrecthandlingofcarryandborrowdatawhenresultsexceed255for
additionandlessthan0forsubtraction.TheincrementanddecrementinstructionsINC,INCA,DEC
andDECAprovideasimplemeansofincreasingordecreasingbyavalueofoneofthevaluesinthe
destinationspecied.