Rev. 1.20 96 January 23, 2015 Rev. 1.20 97 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
Capture Input Mode
ToselectthismodebitsPT0M1andPT0M0inthePTM0C1registershouldbesetto01
respectively.Thismodeenablesexternalsignalstocaptureandstorethepresentvalueoftheinternal
counterandcanthereforebeusedforapplicationssuchaspulsewidthmeasurements.Theexternal
signalissuppliedontheTP1_0,TP1_1orTCK1pinwhichisselectedusingthePT0CKSbitinthe
PTM0C1register.Theinputpinactiveedgecanbeeitherarisingedge,afallingedgeorbothrising
andfallingedges;theactiveedgetransitiontypeisselectedusingthePT0IO1andPT0IO0bitsin
thePTM0C1register.ThecounterisstartedwhenthePT0ONbitchangesfromlowtohighwhichis
initiatedusingtheapplicationprogram.
WhentherequirededgetransitionappearsontheTP1_0,TP1_1orTCK1pinthepresentvaluein
thecounterwillbelatchedintotheCCRAregistersandaPTM0interruptgenerated.Irrespective
ofwhateventsoccurontheTP1_0,TP1_1orTCK1pin,thecounterwillcontinuetofreerununtil
thePT0ONbitchangesfromhightolow.WhenaCCRPcomparematchoccursthecounterwill
resetbacktozero;inthiswaytheCCRPvaluecanbeusedtocontrolthemaximumcountervalue.
WhenaCCRPcomparematchoccursfromComparatorP,aPTM0interruptwillalsobegenerated.
CountingthenumberofoverflowinterruptsignalsfromtheCCRPcanbeausefulmethodin
measuringlongpulsewidths.ThePT0IO1andPT0IO0bitscanselecttheactivetriggeredgeonthe
TP1_0,TP1_1orTCK1pintobearisingedge,fallingedgeorbothedgetypes.IfthePT0IO1and
PT0IO0bitsarebothsethigh,thennocaptureoperationwilltakeplaceirrespectiveofwhathappens
ontheTP1_0,TP1_1orTCK1pin,howeveritmustbenotedthatthecounterwillcontinuetorun.
AstheTP1_0,TP1_1orTCK1pinispinsharedwithotherfunctions,caremustbetakenifthe
PTM0isintheCaptureInputMode.Thisisbecauseifthepinissetupasanoutput,thenany
transitionsonthispinmaycauseaninputcaptureoperationtobeexecuted.ThePT0CCLR,PT0OC
andPT0POLbitsarenotusedinthisMode.