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
AnîEEPROMîInterruptîrequestîwillîtakeîplaceîwhenîtheîEEPROMîInterruptîrequestîîag,îDEF,îisîset,î
whichîoccursîwhenîanîEEPROMîWriteîcycleîends.îToîallowîtheîprogramîtoîbranchîtoîitsîrespectiveî
interruptîvectorîaddress,îtheîglobalîinterruptîenableîbit,îEMI,îandîEEPROMîInterruptîenableîbit,î
DEE,îmustîîżrstîbeîset.îWhenîtheîinterruptîisîenabled,îtheîstackîisînotîfullîandîanîEEPROMîWriteî
cycleîends,îaîsubroutineîcallîtoîtheîrespectiveîEEPROMîInterruptîvector,îwillîtakeîplace.îWhenîtheî
EEPROMîInterruptîisîserviced,îtheîEMIîbitîwillîbeîautomaticallyîclearedîtoîdisableîotherîinterrupts,î
andîtheîEEPROMîinterruptîrequestîîag,îDEF,îwillîalsoîbeîautomaticallyîcleared.
TM Interrupts
TheîTMsîeachîhasîtwoîinterrupts.îAllîofîtheîTMîinterruptsîareîcontainedîwithinîtheîMulti-functionî
Interrupts.îForîeachîofîtheîTMsîthereîareîtwoîinterruptîrequestîflagsîxTMPnFîandîxTMAnFîandî
twoîenableîbitsîxTMPnEîandîxTMAnE.îAîTMîinterruptîrequestîwillîtakeîplaceîwhenîanyîofîtheî
TMîrequestîîagsîareîset,îaîsituationîwhichîoccursîwhenîaîTMîcomparatorîPîorîcomparatorîAîmatchî
situationîhappens.î
Toîallowîtheîprogramîtoîbranchîtoîitsîrespectiveîinterruptîvectorîaddress,îtheîglobalîinterruptîenableî
bit,îEMI,îandîtheîrespectiveîTMîInterruptîenableîbit,îandîassociatedîMulti-functionîinterruptîenableî
bit,îMFnF,îmustîîżrstîbeîset.îWhenîtheîinterruptîisîenabled,îtheîstackîisînotîfullîandîaîTMîcomparatorî
matchîsituationîoccurs,îaîsubroutineîcallîtoîtheîrelevantîTMîInterruptîvectorîlocations,îwillîtakeî
place.îWhenîtheîTMîinterruptîisîserviced,îtheîEMIîbitîwillîbeîautomaticallyîclearedîtoîdisableîotherî
interrupts,îhoweverîonlyîtheîrelatedîMFnFîîagîwillîbeîautomaticallyîcleared.îAsîtheîTMîinterruptî
requestîîagsîwillînotîbeîautomaticallyîcleared,îtheyîhaveîtoîbeîclearedîbyîtheîapplicationîprogram.
Interrupt Wake-up Function
Eachîofîtheîinterruptîfunctionsîhasîtheîcapabilityîofîwakingîupîtheîmicrocontrollerîwhenîinîtheî
SLEEPîorîIDLEîMode.îAîwake-upîisîgeneratedîwhenîanîinterruptîrequestîîagîchangesîfromîlowîtoî
highîandîisîindependentîofîwhetherîtheîinterruptîisîenabledîorînot.îTherefore,îevenîthoughîtheîdeviceî
isîinîtheîSLEEPîorîIDLEîModeîandîitsîsystemîoscillatorîstopped,îsituationsîsuchîasîexternalîedgeî
transitionsîonîtheîexternalîinterruptîpin,îaîlowîpowerîsupplyîvoltageîorîcomparatorîinputîchangeîmayî
causeîtheirîrespectiveîinterruptîîagîtoîbeîsetîhighîandîconsequentlyîgenerateîanîinterrupt.îCareîmustî
thereforeîbeîtakenîifîspuriousîwake-upîsituationsîareîtoîbeîavoided.îIfîanîinterruptîwake-upîfunctionî
isîtoîbeîdisabledîthenîtheîcorrespondingîinterruptîrequestîîagîshouldîbeîsetîhighîbeforeîtheîdeviceî
entersîtheîSLEEPîorîIDLEîMode.îTheîinterruptîenableîbitsîhaveînoîeffectîonîtheîinterruptîwake-upî
function.
Programming Considerations
Byîdisablingîtheîrelevantîinterruptîenableîbits,îaîrequestedîinterruptîcanîbeîpreventedîfromîbeingî
serviced,îhowever,îonceîanîinterruptîrequestîflagîisîset,îitîwillîremainîinîthisîconditionîinîtheî
interruptîregisterîuntilîtheîcorrespondingîinterruptîisîservicedîorîuntilîtheîrequestîîagîisîclearedîbyî
theîapplicationîprogram.î
WhereîaîcertainîinterruptîisîcontainedîwithinîaîMulti-functionîinterrupt,îthenîwhenîtheîinterruptî
serviceîroutineîisîexecuted,îasîonlyîtheîMulti-functionîinterruptîrequestîîags,îMF0F~MF1F,îwillî
beîautomaticallyîcleared,îtheîindividualîrequestîflagîforîtheîfunctionîneedsîtoîbeîclearedîbyîtheî
applicationîprogram.
ItîisîrecommendedîthatîprogramsîdoînotîuseîtheîâCALLâîinstructionîwithinîtheîinterruptîserviceî
subroutine.îInterruptsîoftenîoccurîinîanîunpredictableîmannerîorîneedîtoîbeîservicedîimmediately.î
Ifîonlyîoneîstackîisîleftîandîtheîinterruptîisînotîwellîcontrolled,îtheîoriginalîcontrolîsequenceîwillîbeî
damagedîonceîaîCALLîsubroutineîisîexecutedîinîtheîinterruptîsubroutine.î