Rev. 1.20 136 January 23, 2015 Rev. 1.20 137 January 23, 2015
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
INTC3 Register
Bit 7 6 5 4 3 2 1 0
Name — — — LVDF — — — LVDE
R/W — — — R/W — — — R/W
POR — — — 0 — — — 0
Bit7~5 Unimplemented,readas"0"
Bit4 LVDF:LVDinterruptrequestflag
0:Norequest
1:Interruptrequest
Bit3~1 Unimplemented,readas"0"
Bit0 LVDE:LVDinterruptcontrol
0:Disable
1:Enable
Interrupt Operation
Whentheconditionsforaninterrupteventoccur,suchasaTouchKeyCounteroverflow,aTM
ComparatorPorComparatorAmatch,etc,therelevantinterruptrequestagwillbeset.Whether
therequestagactuallygeneratesaprogramjumptotherelevantinterruptvectorisdeterminedby
theconditionoftheinterruptenablebit.Iftheenablebitissethighthentheprogramwilljumpto
itsrelevantvector;iftheenablebitiszerothenalthoughtheinterruptrequestagissetanactual
interruptwillnotbegeneratedandtheprogramwillnotjumptotherelevantinterruptvector.The
globalinterruptenablebit,ifclearedtozero,willdisableallinterrupts.
Whenaninterruptisgenerated,theProgramCounter,whichstorestheaddressofthenextinstruction
tobeexecuted,willbetransferredontothestack.TheProgramCounterwillthenbeloadedwitha
newaddresswhichwillbethevalueofthecorrespondinginterruptvector.Themicrocontrollerwill
thenfetchitsnextinstructionfromthisinterruptvector.Theinstructionatthisvectorwillusually
bea"JMP"whichwilljumptoanothersectionofprogramwhichisknownastheinterruptservice
routine.Hereislocatedthecodetocontroltheappropriateinterrupt.Theinterruptserviceroutine
mustbeterminatedwitha"RETI",whichretrievestheoriginalProgramCounteraddressfrom
thestackandallowsthemicrocontrollertocontinuewithnormalexecutionatthepointwherethe
interruptoccurred.
Thevariousinterruptenablebits,togetherwiththeirassociatedrequestflags,areshowninthe
accompanyingdiagramswiththeirorderofpriority.Everyinterruptsourcehasitsownindividual
vector.Onceaninterruptsubroutineisserviced,alltheotherinterruptswillbeblocked,astheglobal
interruptenablebit,EMIbitwillbeclearedautomatically.Thiswillpreventanyfurtherinterrupt
nestingfromoccurring.However,ifotherinterruptrequestsoccurduringthisinterval,althoughthe
interruptwillnotbeimmediatelyserviced,therequestagwillstillberecorded.
Ifaninterruptrequiresimmediateservicingwhiletheprogramisalreadyinanotherinterruptservice
routine,theEMIbitshouldbesetafterenteringtheroutine,toallowinterruptnesting.Ifthestack
isfull,theinterruptrequestwillnotbeacknowledged,eveniftherelatedinterruptisenabled,until
theStackPointerisdecremented.Ifimmediateserviceisdesired,thestackmustbepreventedfrom
becomingfull.Incaseofsimultaneousrequests,theaccompanyingdiagramshowstheprioritythat
isapplied.Alloftheinterruptrequestagswhensetwillwake-upthedeviceifitisinSLEEPor
IDLEMode,howevertopreventawake-upfromoccurringthecorrespondingagshouldbeset
beforethedeviceisinSLEEPorIDLEMode.