BS85B12-3/BS85C20-3/BS85C20-5
Touch Key Flash MCU with LCD/LED Driver
Capture Input Mode
ToꢀselectꢀthisꢀmodeꢀbitsꢀTnAM1,ꢀTnAM0ꢀandꢀTnBM1,ꢀTnBM0ꢀinꢀtheꢀTMnC1ꢀandꢀTMnC2ꢀregistersꢀ
shouldꢀbeꢀsetꢀtoꢀ01ꢀrespectively.ꢀThisꢀmodeꢀenablesꢀexternalꢀsignalsꢀtoꢀcaptureꢀandꢀstoreꢀtheꢀ
presentꢀvalueꢀofꢀtheꢀinternalꢀcounterꢀandꢀcanꢀthereforeꢀbeꢀusedꢀforꢀapplicationsꢀsuchꢀasꢀpulseꢀwidthꢀ
measurements.ꢀTheꢀexternalꢀsignalꢀisꢀsuppliedꢀonꢀtheꢀTPnAꢀandꢀTPnB_0,ꢀTPnB_1,ꢀTPnB_2ꢀpins,ꢀ
whoseꢀactiveꢀedgeꢀcanꢀbeꢀeitherꢀaꢀrisingꢀedge,ꢀaꢀfallingꢀedgeꢀorꢀbothꢀrisingꢀandꢀfallingꢀedges;ꢀtheꢀ
activeꢀedgeꢀtransitionꢀtypeꢀisꢀselectedꢀusingꢀtheꢀTnAIO1,ꢀTnAIO0ꢀandꢀTnBIO1,ꢀTnBIO0ꢀbitsꢀinꢀtheꢀ
TMnC1ꢀandꢀTMnC2ꢀregisters.ꢀTheꢀcounterꢀisꢀstartedꢀwhenꢀtheꢀTnONꢀbitꢀchangesꢀfromꢀlowꢀtoꢀhighꢀ
whichꢀisꢀinitiatedꢀusingꢀtheꢀapplicationꢀprogram.
WhenꢀtheꢀrequiredꢀedgeꢀtransitionꢀappearsꢀonꢀtheꢀTPnAꢀandꢀTPnB_0,ꢀTPnB_1,ꢀTPnB_2ꢀpinsꢀtheꢀ
presentꢀvalueꢀinꢀtheꢀcounterꢀwillꢀbeꢀlatchedꢀintoꢀtheꢀCCRAꢀandꢀCCRBꢀregistersꢀandꢀaꢀTMꢀinterruptꢀ
generated.ꢀIrrespectiveꢀofꢀwhatꢀeventsꢀoccurꢀonꢀtheꢀTPnAꢀandꢀTPnB_0,ꢀTPnB_1,ꢀTPnB_2ꢀpinsꢀ
theꢀcounterꢀwillꢀcontinueꢀtoꢀfreeꢀrunꢀuntilꢀtheꢀTnONꢀbitꢀchangesꢀfromꢀhighꢀtoꢀlow.ꢀWhenꢀaꢀCCRPꢀ
compareꢀmatchꢀoccursꢀtheꢀcounterꢀwillꢀresetꢀbackꢀtoꢀzero;ꢀinꢀthisꢀwayꢀtheꢀCCRPꢀvalueꢀcanꢀbeꢀusedꢀ
toꢀcontrolꢀtheꢀmaximumꢀcounterꢀvalue.ꢀWhenꢀaꢀCCRPꢀcompareꢀmatchꢀoccursꢀfromꢀComparatorꢀP,ꢀ
aꢀTMꢀinterruptꢀwillꢀalsoꢀbeꢀgenerated.ꢀCountingꢀtheꢀnumberꢀofꢀoverflowꢀinterruptꢀsignalsꢀfromꢀtheꢀ
CCRPꢀcanꢀbeꢀaꢀusefulꢀmethodꢀinꢀmeasuringꢀlongꢀpulseꢀwidths.ꢀTheꢀTnAIO1,ꢀTnAIO0ꢀandꢀTnBIO1,ꢀ
TnBIO0ꢀbitsꢀcanꢀselectꢀtheꢀactiveꢀtriggerꢀedgeꢀonꢀtheꢀTPnAꢀandꢀTPnB_0,ꢀTPnB_1,ꢀTPnB_2ꢀpinsꢀtoꢀbeꢀ
aꢀrisingꢀedge,ꢀfallingꢀedgeꢀorꢀbothꢀedgeꢀtypes.ꢀIfꢀtheꢀTnAIO1,ꢀTnAIO0ꢀandꢀTnBIO1,ꢀTnBIO0ꢀbitsꢀareꢀ
bothꢀsetꢀhigh,ꢀthenꢀnoꢀcaptureꢀoperationꢀwillꢀtakeꢀplaceꢀirrespectiveꢀofꢀwhatꢀhappensꢀonꢀtheꢀTPnAꢀandꢀ
TPnB_0,ꢀTPnB_1,ꢀTPnB_2ꢀpins,ꢀhoweverꢀitꢀmustꢀbeꢀnotedꢀthatꢀtheꢀcounterꢀwillꢀcontinueꢀtoꢀrun.
Tn�M1ꢂ Tn�M0 = 01
Coꢀnter
Coꢀnter
Valꢀe
overflow
Coꢀnter
Reset
CCRP
Stop
YY
XX
Paꢀse Resꢀme
Time
TnON bit
TnP�U bit
�ctive
edꢁes
�ctive
edꢁe
�ctive
edꢁe
TM Captꢀre Pin
CCR� Int.
Flaꢁ Tn�F
CCRP Int.
Flaꢁ TnPF
CCR�
Valꢀe
XX
YY
XX
YY
Tn�IO1ꢂ Tn�IO0
Valꢀe
00 - Risinꢁ edꢁe
01 - Fallinꢁ edꢁe
10 - Both edꢁes
11 - Disable Captꢀre
ETM CCRA Capture Input Mode
Note:ꢀ1.ꢀTnAMꢀ[1:0]ꢀ=ꢀ01ꢀandꢀactiveꢀedgeꢀsetꢀbyꢀtheꢀTnAIOꢀ[1:0]ꢀbits
2.ꢀTheꢀTMꢀCaptureꢀinputꢀpinꢀactiveꢀedgeꢀtransfersꢀheꢀcounterꢀvalueꢀtoꢀCCRA
3.ꢀTnCCLRꢀbitꢀnotꢀused
4.ꢀNoꢀoutputꢀfunctionꢀ--ꢀTnAOCꢀandꢀTnAPOLꢀbitsꢀnotꢀused
5.ꢀCCRPꢀdeterminesꢀtheꢀcounterꢀvalueꢀandꢀtheꢀcounterꢀhasꢀaꢀmaximumꢀcountꢀvalueꢀwhenꢀCCRPꢀisꢀ
equalꢀtoꢀzero.
Rev. 1.20
113
�ꢀꢁꢀst 10ꢂ 2012