Rev. 1.71 116 April 11, 2017 Rev. 1.71 117 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
External Interrupt
TheexternalinterruptiscontrolledbysignaltransitionsonthepinsINTandINT0~INT1.An
externalinterruptrequestwilltakeplacewhentheexternalinterruptrequestflag,INTnF,isset,
whichwilloccurwhenatransition,whosetypeischosenbytheedgeselectbits,appearsonthe
externalinterruptpin.Toallowtheprogramtobranchtotheinterruptvectoraddress,theglobal
interruptenablebit,EMI,andtheexternalinterruptenablebit,INTnE,mustrstbeset.Additionally
thecorrectinterruptedgetypemustbeselectedusingtheINTEGregistertoenabletheexternal
interruptfunctionandtochoosethetriggeredgetype.Astheexternalinterruptpinsarepin-shared
withI/Opins,theycanonlybeconfiguredasexternalinterruptpinsbysettingthepin-shared
registers.Thepinmustalsobesetupasaninputbysettingthecorrespondingbitintheportcontrol
register.Whentheinterruptisenabled,thestackisnotfullandthecorrecttransitiontypeappears
ontheexternalinterruptpin,asubroutinecalltotheexternalinterruptvector,willtakeplace.When
theinterruptisserviced,theexternalinterruptrequestflag,INTnF,willbeautomaticallyreset
andtheEMIbitwillbeautomaticallyclearedtodisableotherinterrupts.Notethatthepull-high
resistorselectionontheexternalinterruptpinwillremainvalidevenifthepinisusedasanexternal
interruptinput.
TheINTEGregisterisusedtoselectthetypeofactiveedgethatwilltriggertheexternalinterrupt.
Achoiceofeitherrisingorfallingorbothedgetypescanbechosentotriggeranexternalinterrupt.
NotethattheINTEGregistercanalsobeusedtodisabletheexternalinterruptfunction.
Multi-function Interrupt
WithinthesedevicesthereareuptotwoMulti-functioninterrupts.Unliketheotherindependent
interrupts,theseinterruptshavenoindependentsource,butratherareformedfromotherexisting
interruptsources,namelytheTMInterrupts.
AMulti-functioninterruptrequestwilltakeplacewhenanyoftheMulti-functioninterruptrequest
ags,MF0F~MF1Fareset.TheMulti-functioninterruptagswillbesetwhenanyoftheirincluded
functionsgenerateaninterruptrequestag.Toallowtheprogramtobranchtoitsrespectiveinterrupt
vectoraddress,whentheMulti-functioninterruptisenabledandthestackisnotfull,andeitherone
oftheinterruptscontainedwithineachofMulti-functioninterruptoccurs,asubroutinecalltooneof
theMulti-functioninterruptvectorswilltakeplace.Whentheinterruptisserviced,therelatedMulti-
Functionrequestag,willbeautomaticallyresetandtheEMIbitwillbeautomaticallyclearedto
disableotherinterrupts.
However,itmustbenotedthat,althoughtheMulti-functionInterruptagswillbeautomatically
resetwhentheinterruptisserviced,therequestagsfromtheoriginalsourceoftheMulti-function
interrupts,namelytheTMInterrupts,willnotbeautomaticallyresetandmustbemanuallyresetby
theapplicationprogram.
A/D Converter Interrupt
ThedevicescontainanA/Dconverterwhichhasitsownindependentinterrupt.TheA/DConverter
InterruptiscontrolledbytheterminationofanA/Dconversionprocess.AnA/DConverterInterrupt
requestwilltakeplacewhentheA/DConverterInterruptrequestag,ADF,isset,whichoccurs
whentheA/Dconversionprocessnishes.Toallowtheprogramtobranchtoitsrespectiveinterrupt
vectoraddress,theglobalinterruptenablebit,EMI,andA/DInterruptenablebit,ADE,mustrstbe
set.Whentheinterruptisenabled,thestackisnotfullandtheA/Dconversionprocesshasended,a
subroutinecalltotheA/DConverterInterruptvector,willtakeplace.Whentheinterruptisserviced,
theA/DConverterInterruptflag,ADF,willbeautomaticallycleared.TheEMIbitwillalsobe
automaticallyclearedtodisableotherinterrupts.