Rev. 1.50 70 August 28, 2017 Rev. 1.50 71 August 28, 2017
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
Timer Modules – TM
Oneofthemostfundamentalfunctionsinanymicrocontrollerdevicesistheabilitytocontroland
measuretime.ToimplementtimerelatedfunctionseachdeviceincludesseveralTimerModules,
generallyabbreviatedtothenameTM.TheTMsaremulti-purposetimingunitsandservetoprovide
operationssuchasTimer/Counter,InputCapture,CompareMatchOutputandSinglePulseOutput
aswellasbeingthefunctionalunitforthegenerationofPWMsignals.EachoftheTMshastwo
interrupts.TheadditionofinputandoutputpinsforeachTMensuresthatusersareprovidedwith
timingunitswithawideandexiblerangeoffeatures.
ThecommonfeaturesofthedifferentTMtypesaredescribedherewithmoredetailedinformation
providedintheindividualCompact,StandardandPeriodicTMsections.
Introduction
ThedevicescontaintwoorthreeTMsdependinguponwhichdeviceisselectedwitheachTM
havingareferencenameofTM0,TM1,andTM2.EachindividualTMcanbecategorisedasa
certaintype,namelyCompactTypeTM,StandardTypeTMorPeriodicTypeTM.Althoughsimilar
innature,thedifferentTMtypesvaryintheirfeaturecomplexity.Thecommonfeaturestoallofthe
Compact,StandardandPeriodicTMswillbedescribedinthissectionandthedetailedoperation
regardingeachoftheTMtypeswillbedescribedinseparatesections.Themainfeaturesand
differencesbetweenthethreetypesofTMsaresummarisedintheaccompanyingtable.
TM Function CTM STM PTM
Timer/Counter √ √ √
Input Capture — √ √
Compare Match Output √ √ √
PWM Channels 1 1 1
Single Pulse Output — 1 1
PWM Alignment Edge Edge Edge
PWM Adjustment Period & Duty Duty or Period Duty or Period Duty or Period
TM Function Summary
EachdeviceintheseriescontainsaspecicnumberofeitherCompactType,StandardTypeand
PeriodicTypeTMunitswhichareshowninthetabletogetherwiththeirindividualreferencename,
TM0~TM2.
Device TM0 TM1 TM2
HT66F0175 10-bit PTM 10-bit PTM —
HT66F0185 16-bit STM 10-bit PTM 16-bit CTM
TM Name/Type Reference
TM Operation
ThedifferenttypesofTMofferadiverserangeoffunctions,fromsimpletimingoperationstoPWM
signalgeneration.ThekeytounderstandinghowtheTMoperatesistoseeitintermsofafree
runningcount-upcounterwhosevalueisthencomparedwiththevalueofpre-programmedinternal
comparators.Whenthefreerunningcount-upcounterhasthesamevalueasthepre-programmed
comparator,knownasacomparematchsituation,aTMinterruptsignalwillbegeneratedwhich
canclearthecounterandperhapsalsochangetheconditionoftheTMoutputpin.TheinternalTM
counterisdrivenbyauserselectableclocksource,whichcanbeaninternalclockoranexternalpin.