BS85B12-3/BS85C20-3/BS85C20-5
Touch Key Flash MCU with LCD/LED Driver
Timer Modules – TM
Oneꢀofꢀtheꢀmostꢀfundamentalꢀfunctionsꢀinꢀanyꢀmicrocontrollerꢀdeviceꢀisꢀtheꢀabilityꢀtoꢀcontrolꢀandꢀ
measureꢀtime.ꢀToꢀimplementꢀtimeꢀrelatedꢀfunctionsꢀeachꢀdeviceꢀincludesꢀseveralꢀTimerꢀModules,ꢀ
abbreviatedꢀtoꢀtheꢀnameꢀTM.ꢀTheꢀTMsꢀareꢀmulti-purposeꢀtimingꢀunitsꢀandꢀserveꢀtoꢀprovideꢀ
operationsꢀsuchꢀasꢀTimer/Counter,ꢀInputꢀCapture,ꢀCompareꢀMatchꢀOutputꢀandꢀSingleꢀPulseꢀOutputꢀ
asꢀwellꢀasꢀbeingꢀtheꢀfunctionalꢀunitꢀforꢀtheꢀgenerationꢀofꢀPWMꢀsignals.ꢀEachꢀofꢀtheꢀTMsꢀhasꢀeitherꢀ
twoꢀorꢀthreeꢀindividualꢀinterrupts.ꢀTheꢀadditionꢀofꢀinputꢀandꢀoutputꢀpinsꢀforꢀeachꢀTMꢀensuresꢀthatꢀ
usersꢀareꢀprovidedꢀwithꢀtimingꢀunitsꢀwithꢀaꢀwideꢀandꢀflexibleꢀrangeꢀofꢀfeatures.
TheꢀcommonꢀfeaturesꢀofꢀtheꢀdifferentꢀTMꢀtypesꢀareꢀdescribedꢀhereꢀwithꢀmoreꢀdetailedꢀinformationꢀ
providedꢀinꢀtheꢀindividualꢀCompact,ꢀStandardꢀandꢀEnhancedꢀTMꢀsections.
Introduction
TheꢀdevicesꢀcontainꢀfromꢀtwoꢀtoꢀthreeꢀTMsꢀdependingꢀuponꢀwhichꢀdeviceꢀisꢀselectedꢀwithꢀeachꢀ
TMꢀhavingꢀaꢀreferenceꢀnameꢀofꢀTM0,ꢀTM1ꢀandꢀTM2.ꢀEachꢀindividualꢀTMꢀcanꢀbeꢀcategorisedꢀasꢀ
aꢀcertainꢀtype,ꢀnamelyꢀCompactꢀTypeꢀTM,ꢀStandardꢀTypeꢀTMꢀorꢀEnhancedꢀTypeꢀTM.ꢀAlthoughꢀ
similarꢀinꢀnature,ꢀtheꢀdifferentꢀTMꢀtypesꢀvaryꢀinꢀtheirꢀfeatureꢀcomplexity.ꢀTheꢀcommonꢀfeaturesꢀ
toꢀallꢀofꢀtheꢀCompact,ꢀStandardꢀandꢀEnhancedꢀTMsꢀwillꢀbeꢀdescribedꢀinꢀthisꢀsection,ꢀtheꢀdetailedꢀ
operationꢀregardingꢀeachꢀofꢀtheꢀTMꢀtypesꢀwillꢀbeꢀdescribedꢀinꢀseparateꢀsections.ꢀTheꢀmainꢀfeaturesꢀ
andꢀdifferencesꢀbetweenꢀtheꢀthreeꢀtypesꢀofꢀTMsꢀareꢀsummarisedꢀinꢀtheꢀaccompanyingꢀtable.
Function
CTM
STM
ETM
Timer/Coꢀnter
I/P Captꢀre
√
√
√
—
√
√
Compare Match Oꢀtpꢀt
PWM Channels
√
√
√
1
—
1
2
Sinꢁle Pꢀlse Oꢀtpꢀt
PWM �liꢁnment
1
2
Edꢁe
Edꢁe
Edꢁe & Centre
Dꢀty or Period
PWM �djꢀstment Period & Dꢀty
Dꢀty or Period
TM Function Summary
Dꢀty or Period
EachꢀdeviceꢀinꢀtheꢀseriesꢀcontainsꢀaꢀspecificꢀnumberꢀofꢀeitherꢀCompactꢀType,ꢀStandardꢀTypeꢀandꢀ
EnhancedꢀTypeꢀTMꢀunitsꢀwhichꢀareꢀshownꢀinꢀtheꢀtableꢀtogetherꢀwithꢀtheirꢀindividualꢀreferenceꢀname,ꢀ
TM0~TM2.
Device
TM0
TM1
TM2
BS85B12-3
10-bit CTM
10-bit ETM
—
BS85C20-3
/BS85C20-5
10-bit CTM
10-bit ETM
10-bit STM
TM Name/Type Reference
TM Operation
TheꢀthreeꢀdifferentꢀtypesꢀofꢀTMꢀofferꢀaꢀdiverseꢀrangeꢀofꢀfunctions,ꢀfromꢀsimpleꢀtimingꢀoperationsꢀ
toꢀPWMꢀsignalꢀgeneration.ꢀTheꢀkeyꢀtoꢀunderstandingꢀhowꢀtheꢀTMꢀoperatesꢀisꢀtoꢀseeꢀitꢀinꢀtermsꢀofꢀ
aꢀfreeꢀrunningꢀcounterꢀwhoseꢀvalueꢀisꢀthenꢀcomparedꢀwithꢀtheꢀvalueꢀofꢀpre-programmedꢀinternalꢀ
comparators.ꢀWhenꢀtheꢀfreeꢀrunningꢀcounterꢀhasꢀtheꢀsameꢀvalueꢀasꢀtheꢀpre-programmedꢀcomparator,ꢀ
knownꢀasꢀaꢀcompareꢀmatchꢀsituation,ꢀaꢀTMꢀinterruptꢀsignalꢀwillꢀbeꢀgeneratedꢀwhichꢀcanꢀclearꢀtheꢀ
counterꢀandꢀperhapsꢀalsoꢀchangeꢀtheꢀconditionꢀofꢀtheꢀTMꢀoutputꢀpin.ꢀTheꢀinternalꢀTMꢀcounterꢀisꢀ
drivenꢀbyꢀaꢀuserꢀselectableꢀclockꢀsource,ꢀwhichꢀcanꢀbeꢀanꢀinternalꢀclockꢀorꢀanꢀexternalꢀpin.
Rev. 1.20
67
�ꢀꢁꢀst 10ꢂ 2012