Rev. 1.50 110 August 28, 2017 Rev. 1.50 111 August 28, 2017
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
Timer/Counter Mode
Toselectthismode,bitsTnM1andTnM0intheTMnC1registershouldbesetto11respectively.
TheTimer/CounterModeoperatesinanidenticalwaytotheCompareMatchOutputMode
generatingthesameinterruptags.TheexceptionisthatintheTimer/CounterModetheTMnoutput
pinisnotused.ThereforetheabovedescriptionandTimingDiagramsfortheCompareMatch
OutputModecanbeusedtounderstanditsfunction.AstheTMnoutputpinisnotusedinthismode,
thepincanbeusedasanormalI/Opinorotherpin-sharedfunction.
PWM Output Mode
Toselectthismode,bitsTnM1andTnM0intheTMnC1registershouldbesetto10respectively
andalsotheTnIO1andTnIO0bitsshouldbesetto10respectively.ThePWMfunctionwithin
theTMnisusefulforapplicationswhichrequirefunctionssuchasmotorcontrol,heatingcontrol,
illuminationcontrol,etc.Byprovidingasignalofxedfrequencybutofvaryingdutycycleonthe
TMnoutputpin,asquarewaveACwaveformcanbegeneratedwithvaryingequivalentDCRMS
values.
AsboththeperiodanddutycycleofthePWMwaveformcanbecontrolled,thechoiceofgenerated
waveformisextremelyflexible.InthePWMmode,theTnCCLRbithasnoeffectasthePWM
period.BothoftheCCRPandCCRAregistersareusedtogeneratethePWMwaveform,oneregister
isusedtocleartheinternalcounterandthuscontrolthePWMwaveformfrequency,whiletheother
oneisusedtocontrolthedutycycle.ThePWMwaveformfrequencyanddutycyclecantherefore
becontrolledbythevaluesintheCCRAandCCRPregisters.
Aninterruptag,oneforeachoftheCCRAandCCRP,willbegeneratedwhenacomparematch
occursfromeitherComparatorAorComparatorP.TheTnOCbitintheTMnC1registerisusedto
selecttherequiredpolarityofthePWMwaveformwhilethetwoTnIO1andTnIO0bitsareusedto
enablethePWMoutputortoforcetheTMnoutputpintoaxedhighorlowlevel.TheTnPOLbit
isusedtoreversethepolarityofthePWMoutputwaveform.
• 10-bit PTM, PWM Mode
CCRP 1~1023 0
Period 1~1023 1024
Duty CCRA
Iff
SYS
=16MHz,TMclocksourceselectf
SYS
/4,CCRP=512andCCRA=128,
TheTMnPWMoutputfrequency=(f
SYS
/4)/512=f
SYS
/2048=7.8125kHz,duty=128/512=25%,
IftheDutyvaluedenedbytheCCRAregisterisequaltoorgreaterthanthePeriodvalue,thenthe
PWMoutputdutyis100%.