Rev. 1.71 118 April 11, 2017 Rev. 1.71 119 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
EEPROM Interrupt
AnEEPROMInterruptrequestwilltakeplacewhentheEEPROMInterruptrequestag,DEF,isset,
whichoccurswhenanEEPROMWritecycleends.Toallowtheprogramtobranchtoitsrespective
interruptvectoraddress,theglobalinterruptenablebit,EMI,andEEPROMInterruptenablebit,
DEE,mustrstbeset.Whentheinterruptisenabled,thestackisnotfullandanEEPROMWrite
cycleends,asubroutinecalltotherespectiveEEPROMInterruptvector,willtakeplace.Whenthe
EEPROMInterruptisserviced,theEMIbitwillbeautomaticallyclearedtodisableotherinterrupts,
andtheEEPROMinterruptrequestag,DEF,willalsobeautomaticallycleared.
TM Interrupts
TheTMseachhastwointerrupts.AlloftheTMinterruptsarecontainedwithintheMulti-function
Interrupts.ForeachoftheTMstherearetwointerruptrequestflagsxTMPnFandxTMAnFand
twoenablebitsxTMPnEandxTMAnE.ATMinterruptrequestwilltakeplacewhenanyofthe
TMrequestagsareset,asituationwhichoccurswhenaTMcomparatorPorcomparatorAmatch
situationhappens.
Toallowtheprogramtobranchtoitsrespectiveinterruptvectoraddress,theglobalinterruptenable
bit,EMI,andtherespectiveTMInterruptenablebit,andassociatedMulti-functioninterruptenable
bit,MFnF,mustrstbeset.Whentheinterruptisenabled,thestackisnotfullandaTMcomparator
matchsituationoccurs,asubroutinecalltotherelevantTMInterruptvectorlocations,willtake
place.WhentheTMinterruptisserviced,theEMIbitwillbeautomaticallyclearedtodisableother
interrupts,howeveronlytherelatedMFnFagwillbeautomaticallycleared.AstheTMinterrupt
requestagswillnotbeautomaticallycleared,theyhavetobeclearedbytheapplicationprogram.
Interrupt Wake-up Function
Eachoftheinterruptfunctionshasthecapabilityofwakingupthemicrocontrollerwheninthe
SLEEPorIDLEMode.Awake-upisgeneratedwhenaninterruptrequestagchangesfromlowto
highandisindependentofwhethertheinterruptisenabledornot.Therefore,eventhoughthedevice
isintheSLEEPorIDLEModeanditssystemoscillatorstopped,situationssuchasexternaledge
transitionsontheexternalinterruptpin,alowpowersupplyvoltageorcomparatorinputchangemay
causetheirrespectiveinterruptagtobesethighandconsequentlygenerateaninterrupt.Caremust
thereforebetakenifspuriouswake-upsituationsaretobeavoided.Ifaninterruptwake-upfunction
istobedisabledthenthecorrespondinginterruptrequestagshouldbesethighbeforethedevice
enterstheSLEEPorIDLEMode.Theinterruptenablebitshavenoeffectontheinterruptwake-up
function.
Programming Considerations
Bydisablingtherelevantinterruptenablebits,arequestedinterruptcanbepreventedfrombeing
serviced,however,onceaninterruptrequestflagisset,itwillremaininthisconditioninthe
interruptregisteruntilthecorrespondinginterruptisservicedoruntiltherequestagisclearedby
theapplicationprogram.
WhereacertaininterruptiscontainedwithinaMulti-functioninterrupt,thenwhentheinterrupt
serviceroutineisexecuted,asonlytheMulti-functioninterruptrequestags,MF0F~MF1F,will
beautomaticallycleared,theindividualrequestflagforthefunctionneedstobeclearedbythe
applicationprogram.
Itisrecommendedthatprogramsdonotusethe“CALL”instructionwithintheinterruptservice
subroutine.Interruptsoftenoccurinanunpredictablemannerorneedtobeservicedimmediately.
Ifonlyonestackisleftandtheinterruptisnotwellcontrolled,theoriginalcontrolsequencewillbe
damagedonceaCALLsubroutineisexecutedintheinterruptsubroutine.