Rev. 1.20 90 January 23, 2015 Rev. 1.20 91 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
PTM0RPH Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — D9 D8
R/W — — — — — — R/W R/W
POR — — — — — — 0 0
Bit7~2 Unimplemented,readas"0"
B
it1~0 PTM0CCRPHighByteRegisterbit1~bit0
PTM0
10-bitCCRPbit9~bit8
Periodic Type TM Operating Modes
ThePeriodicTypeTMcanoperateinoneofveoperatingmodes,CompareMatchOutputMode,
PWMOutputMode,SinglePulseOutputMode,CaptureInputModeorTimer/CounterMode.The
operatingmodeisselectedusingthePT0M1andPT0M0bitsinthePTM0C1register.
Compare Match Output Mode
Toselectthismode,bitsPT0M1andPT0M0inthePTM0C1register,shouldbesetto00
respectively.Inthismodeoncethecounterisenabledandrunningitcanbeclearedbythree
methods.Theseareacounteroverow,acomparematchfromComparatorAandacomparematch
fromComparatorP.WhenthePT0CCLRbitislow,therearetwowaysinwhichthecountercanbe
cleared.OneiswhenacomparematchfromComparatorP,theotheriswhentheCCRPbitsareall
zerowhichallowsthecountertooverow.HerebothPTMA0FandPTMP0Finterruptrequestags
forComparatorAandComparatorPrespectively,willbothbegenerated.
IfthePT0CCLRbitinthePTM0C1registerishighthenthecounterwillbeclearedwhenacompare
matchoccursfromComparatorA.However,hereonlythePTMA0Finterruptrequestflagwill
begeneratedevenifthevalueoftheCCRPbitsislessthanthatoftheCCRAregisters.Therefore
whenPT0CCLRishighnoPTMP0Finterruptrequestagwillbegenerated.IntheCompareMatch
OutputMode,theCCRAcannotbeclearedtozero.
IftheCCRAbitsareallzero,thecounterwilloverowwhenitsreachesitsmaximum10-bit,3FF
Hex,value,howeverherethePTMA0Finterruptrequestagwillnotbegenerated.
Asthenameofthemodesuggests,afteracomparisonismade,thePTM0outputpin,willchange
state.ThePTM0outputpinconditionhoweveronlychangesstatewhenaPTMA0Finterruptrequest
agisgeneratedafteracomparematchoccursfromComparatorA.ThePTMP0Finterruptrequest
ag,generatedfromacomparematchoccursfromComparatorP,willhavenoeffectonthePTM0
outputpin.ThewayinwhichthePTM0outputpinchangesstatearedeterminedbytheconditionof
thePT0IO1andPT0IO0bitsinthePTM0C1register.ThePTM0outputpincanbeselectedusing
thePT0IO1andPT0IO0bitstogohigh,togolowortotogglefromitspresentconditionwhena
comparematchoccursfromComparatorA.TheinitialconditionofthePTM0outputpin,whichis
setupafterthePT0ONbitchangesfromlowtohigh,issetupusingthePT0OCbit.Notethatifthe
PT0IO1andPT0IO0bitsarezerothennopinchangewilltakeplace.