BS85B12-3/BS85C20-3/BS85C20-5
Touch Key Flash MCU with LCD/LED Driver
TM Clock Source
TheꢀclockꢀsourceꢀwhichꢀdrivesꢀtheꢀmainꢀcounterꢀinꢀeachꢀTMꢀcanꢀoriginateꢀfromꢀvariousꢀsources.ꢀ
TheꢀselectionꢀofꢀtheꢀrequiredꢀclockꢀsourceꢀisꢀimplementedꢀusingꢀtheꢀTnCK2~TnCK0ꢀbitsꢀinꢀtheꢀTMꢀ
controlꢀregisters.ꢀTheꢀclockꢀsourceꢀcanꢀbeꢀaꢀratioꢀofꢀeitherꢀtheꢀsystemꢀclockꢀfSYSꢀorꢀtheꢀinternalꢀhighꢀ
clockꢀfH,ꢀtheꢀfTBCꢀclockꢀsourceꢀorꢀtheꢀexternalꢀTCKnꢀpin.ꢀNoteꢀthatꢀsettingꢀtheseꢀbitsꢀtoꢀtheꢀvalueꢀ101ꢀ
willꢀselectꢀaꢀreservedꢀclockꢀinput,ꢀinꢀeffectꢀdisconnectingꢀtheꢀTMꢀclockꢀsource.ꢀTheꢀTCKnꢀpinꢀclockꢀ
sourceꢀisꢀusedꢀtoꢀallowꢀanꢀexternalꢀsignalꢀtoꢀdriveꢀtheꢀTMꢀasꢀanꢀexternalꢀclockꢀsourceꢀorꢀforꢀeventꢀ
counting.
TM Interrupts
TheꢀCompactꢀandꢀStandardꢀtypeꢀTMsꢀeachꢀhaveꢀtwoꢀinternalꢀinterrupts,ꢀoneꢀforꢀeachꢀofꢀtheꢀinternalꢀ
comparatorꢀAꢀorꢀcomparatorꢀP,ꢀwhichꢀgenerateꢀaꢀTMꢀinterruptꢀwhenꢀaꢀcompareꢀmatchꢀconditionꢀ
occurs.ꢀAsꢀtheꢀEnhancedꢀtypeꢀTMꢀhasꢀthreeꢀinternalꢀcomparatorsꢀandꢀcomparatorꢀAꢀorꢀcomparatorꢀ
BꢀorꢀcomparatorꢀPꢀcompareꢀmatchꢀfunctions,ꢀitꢀconsequentlyꢀhasꢀthreeꢀinternalꢀinterrupts.ꢀWhenꢀaꢀ
TMꢀinterruptꢀisꢀgeneratedꢀitꢀcanꢀbeꢀusedꢀtoꢀclearꢀtheꢀcounterꢀandꢀalsoꢀtoꢀchangeꢀtheꢀstateꢀofꢀtheꢀTMꢀ
outputꢀpin.
TM External Pins
EachꢀofꢀtheꢀTMs,ꢀirrespectiveꢀofꢀwhatꢀtype,ꢀhasꢀoneꢀTMꢀinputꢀpin,ꢀwithꢀtheꢀlabelꢀTCKn.ꢀTheꢀTMꢀ
inputꢀpin,ꢀisꢀessentiallyꢀaꢀclockꢀsourceꢀforꢀtheꢀTMꢀandꢀisꢀselectedꢀusingꢀtheꢀTnCK2~TnCK0ꢀbitsꢀinꢀ
theꢀTMnC0ꢀregister.ꢀThisꢀexternalꢀTMꢀinputꢀpinꢀallowsꢀanꢀexternalꢀclockꢀsourceꢀtoꢀdriveꢀtheꢀinternalꢀ
TM.ꢀThisꢀexternalꢀTMꢀinputꢀpinꢀisꢀsharedꢀwithꢀotherꢀfunctionsꢀbutꢀwillꢀbeꢀconnectedꢀtoꢀtheꢀinternalꢀ
TMꢀifꢀselectedꢀusingꢀtheꢀTnCK2~TnCK0ꢀbits.ꢀTheꢀTMꢀinputꢀpinꢀcanꢀbeꢀchosenꢀtoꢀhaveꢀeitherꢀaꢀ
risingꢀorꢀfallingꢀactiveꢀedge.
TheꢀTMsꢀeachꢀhaveꢀoneꢀorꢀmoreꢀoutputꢀpinsꢀwithꢀtheꢀlabelꢀTPn.ꢀWhenꢀtheꢀTMꢀisꢀinꢀtheꢀCompareꢀ
MatchꢀOutputꢀMode,ꢀtheseꢀpinsꢀcanꢀbeꢀcontrolledꢀbyꢀtheꢀTMꢀtoꢀswitchꢀtoꢀaꢀhighꢀorꢀlowꢀlevelꢀorꢀtoꢀ
toggleꢀwhenꢀaꢀcompareꢀmatchꢀsituationꢀoccurs.ꢀTheꢀexternalꢀTPnꢀoutputꢀpinꢀisꢀalsoꢀtheꢀpinꢀwhereꢀ
theꢀTMꢀgeneratesꢀtheꢀPWMꢀoutputꢀwaveform.ꢀAsꢀtheꢀTMꢀoutputꢀpinsꢀareꢀpin-sharedꢀwithꢀotherꢀ
function,ꢀtheꢀTMꢀoutputꢀfunctionꢀmustꢀfirstꢀbeꢀsetupꢀusingꢀregisters.ꢀAꢀsingleꢀbitꢀinꢀoneꢀofꢀtheꢀ
registersꢀdeterminesꢀifꢀitsꢀassociatedꢀpinꢀisꢀtoꢀbeꢀusedꢀasꢀanꢀexternalꢀTMꢀoutputꢀpinꢀorꢀifꢀitꢀisꢀtoꢀhaveꢀ
anotherꢀfunction.ꢀTheꢀnumberꢀofꢀoutputꢀpinsꢀforꢀeachꢀTMꢀtypeꢀandꢀdeviceꢀisꢀdifferent,ꢀtheꢀdetailsꢀareꢀ
providedꢀinꢀtheꢀaccompanyingꢀtable.
AllꢀTMꢀoutputꢀpinꢀnamesꢀhaveꢀanꢀ"_n"ꢀsuffix.ꢀPinꢀnamesꢀthatꢀincludeꢀaꢀ"_1"ꢀorꢀ"_2"ꢀsuffixꢀindicateꢀ
thatꢀtheyꢀareꢀfromꢀaꢀTMꢀwithꢀmultipleꢀoutputꢀpins.ꢀThisꢀallowsꢀtheꢀTMꢀtoꢀgenerateꢀaꢀcomplimentaryꢀ
outputꢀpair,ꢀselectedꢀusingꢀtheꢀI/Oꢀregisterꢀdataꢀbits.
Device
CTM
STM
ETM
Registers
TP1�ꢂ TP1B_0ꢂ
TP1B_1ꢂ TP1B_2
BS85B12-3
TP0_0ꢂ TP0_1
—
TMPC0
BS85C20-3
/BS85C20-5
TP1�ꢂ TP1B_0ꢂ
TP1B_1ꢂ TP1B_2
TP0_0ꢂ TP0_1
TP2_0ꢂ TP2_1
TMPC0ꢂ TMPC1
TM Output Pins
Rev. 1.20
68
�ꢀꢁꢀst 10ꢂ 2012