Rev. 2.50 158 June 22, 2017 Rev. 2.50 159 June 22, 2017
HT66F20/HT66F30/HT66F40/HT66F50/HT66F60
HT66FU30/HT66FU40/HT66FU50/HT66FU60
A/D Flash MCU with EEPROM
HT66F20/HT66F30/HT66F40/HT66F50/HT66F60
HT66FU30/HT66FU40/HT66FU50/HT66FU60
A/D Flash MCU with EEPROM
Timer/Counter Mode
Toselectthismode,bitsTnAM1,TnAM0andTnBM1,TnBM0intheTMnC1andTMnC2register
shouldallbesethigh.TheTimer/CounterModeoperatesinanidenticalwaytotheCompare
MatchOutputModegeneratingthesameinterruptags.TheexceptionisthatintheTimer/Counter
ModetheTMoutputpinisnotused.ThereforetheabovedescriptionandTimingDiagramsforthe
CompareMatchOutputModecanbeusedtounderstanditsfunction.AstheTMoutputpinisnot
usedinthismode,thepincanbeusedasanormalI/Opinorotherpin-sharedfunction.
PWM Output Mode
Toselectthismode,therequiredbitpairs,TnAM1,TnAM0andTnBM1,TnBM0shouldbeset
to10respectivelyandalsotheTnAIO1,TnAIO0andTnBIO1,TnBIO0bitsshouldbesetto10
respectively.ThePWMfunctionwithintheTMisusefulforapplicationswhichrequirefunctions
suchasmotorcontrol,heatingcontrol,illuminationcontroletc.Byprovidingasignaloffixed
frequencybutofvaryingdutycycleontheTMoutputpin,asquarewaveACwaveformcanbe
generatedwithvaryingequivalentDCRMSvalues.
AsboththeperiodanddutycycleofthePWMwaveformcanbecontrolled,thechoiceofgenerated
waveformisextremelyexible.InthePWMmode,theTnCCLRbitisusedtodetermineinwhich
waythePWMperiodiscontrolled.WiththeTnCCLRbitsethigh,thePWMperiodcanbenely
controlledusingtheCCRAregisters.InthiscasetheCCRBregistersareusedtosetthePWMduty
value(forTPnBoutputpins).TheCCRPbitsarenotusedandTPnAoutputpinisnotused.The
PWMoutputcanonlybegeneratedontheTPnBoutputpins.WiththeTnCCLRbitclearedtozero,
thePWMperiodissetusingoneoftheeightvaluesofthethreeCCRPbits,inmultiplesof128.
NowbothCCRAandCCRBregisterscanbeusedtosetupdifferentdutycyclevaluestoprovide
dualPWMoutputsontheirrelativeTPnAandTPnBpins.
TheTnPWM1andTnPWM0bitsdeterminethePWMalignmenttype,whichcanbeeitheredge
orcentretype.Inedgealignment,theleadingedgeofthePWMsignalswillallbegenerated
concurrentlywhenthecounterisresettozero.Withallpowercurrentsswitchingonatthesame
time,thismaygiverisetoproblemsinhigherpowerapplications.Incentrealignmentthecentre
ofthePWMactivesignalswilloccursequentially,thusreducingthelevelofsimultaneouspower
switchingcurrents.
Interruptags,oneforeachoftheCCRA,CCRBandCCRP,willbegeneratedwhenacompare
matchoccursfromeithertheComparatorA,ComparatorBorComparatorP.TheTnAOCand
TnBOCbitsintheTMnC1andTMnC2registerareusedtoselecttherequiredpolarityofthePWM
waveformwhilethetwoTnAIO1,TnAIO0andTnBIO1,TnBIO0bitspairsareusedtoenablethe
PWMoutputortoforcetheTMoutputpintoaxedhighorlowlevel.TheTnAPOLandTnBPOL
bitareusedtoreversethepolarityofthePWMoutputwaveform.