Rev. 1.20 78 January 23, 2015 Rev. 1.20 79 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
Compact Type TM Operating Modes
TheCompactTypeTMcanoperateinoneofthreeoperatingmodes,CompareMatchOutputMode,
PWMOutputModeorTimer/CounterMode.TheoperatingmodeisselectedusingtheCT0M1and
CT0M0bitsintheCTM0C1register.
Compare Match Output Mode
Toselectthismode,bitsCT0M1andCT0M0intheCTM0C1register,shouldbesetto00
respectively.Inthismodeoncethecounterisenabledandrunningitcanbeclearedbythree
methods.Theseareacounteroverow,acomparematchfromComparatorAandacomparematch
fromComparatorP.WhentheCT0CCLRbitislow,therearetwowaysinwhichthecountercanbe
cleared.OneiswhenacomparematchfromComparatorP,theotheriswhentheCCRPbitsareall
zerowhichallowsthecountertooverow.HerebothCTMA0FandCTMP0Finterruptrequestags
forComparatorAandComparatorPrespectively,willbothbegenerated.
IftheCT0CCLRbitintheCTM0C1registerishighthenthecounterwillbeclearedwhenacompare
matchoccursfromComparatorA.However,hereonlytheCTMA0Finterruptrequestagwillbe
generatedevenifthevalueoftheCCRPbitsislessthanthatoftheCCRAregisters.Thereforewhen
CT0CCLRishighnoCTMP0Finterruptrequestagwillbegenerated.IftheCCRAbitsareall
zero,thecounterwilloverowwhenitsreachesitsmaximum10-bit,3FFHex,value,howeverhere
theCTMA0Finterruptrequestagwillnotbegenerated.
Asthenameofthemodesuggests,afteracomparisonismade,theCTM0outputpinwillchange
state.TheCTM0outputpinconditionhoweveronlychangesstatewhenaCTMA0Finterrupt
requestagisgeneratedafteracomparematchoccursfromComparatorA.TheCTMP0Finterrupt
requestag,generatedfromacomparematchoccursfromComparatorP,willhavenoeffecton
theCTM0outputpin.ThewayinwhichtheCTM0outputpinchangesstatearedeterminedby
theconditionoftheCT0IO1andCT0IO0bitsintheCTM0C1register.TheCTM0outputpincan
beselectedusingtheCT0IO1andCT0IO0bitstogohigh,togolowortotogglefromitspresent
conditionwhenacomparematchoccursfromComparatorA.TheinitialconditionoftheCTM0
outputpin,whichissetupaftertheCT0ONbitchangesfromlowtohigh,issetupusingtheCT0OC
bit.NotethatiftheCT0IO1andCT0IO0bitsarezerothennopinchangewilltakeplace.