Rev. 1.71 86 April 11, 2017 Rev. 1.71 87 April 11, 2017
HT66F002/HT66F0025/HT66F003/HT66F004
Cost-Effective A/D Flash MCU with EEPROM
HT66F002/HT66F0025/HT66F003/HT66F004
Cost-Effective A/D Flash MCU with EEPROM
IntheCompareMatchOutputMode,thePTnIO1andPTnIO0bitsdeterminehowtheTMoutput
pinchangesstatewhenacomparematchoccursfromtheComparatorA.TheTMoutputpincan
besetuptoswitchhigh,switchlowortotoggleitspresentstatewhenacomparematchoccurs
fromtheComparatorA.Whenthesebitsarebothzero,thennochangewilltakeplaceonthe
output.TheinitialvalueoftheTMoutputpinshouldbesetupusingthePTnOCbit.Notethatthe
outputlevelrequestedbythePT1IO1andPTnIO0bitsmustbedifferentfromtheinitialvalue
setupusingthePTnOCbitotherwisenochangewilloccurontheTMoutputpinwhenacompare
matchoccurs.AftertheTMoutputpinchangesstate,itcanberesettoitsinitiallevelbychanging
thelevelofthePTnONbitfromlowtohigh.
InthePWMMode,thePTnIO1andPTnIO0bitsdeterminehowtheTMoutputpinchanges
statewhenacertaincomparematchconditionoccurs.ThePWMoutputfunctionismodiedby
changingthesetwobits.ItisnecessarytochangethevaluesofthePTnIO1andPTnIO0bitsonly
aftertheTMhasbeenswitchedoff.UnpredictablePWMoutputswilloccurifthePTnIO1and
PTnIO0bitsarechangedwhentheTMisrunning.
Bit3 PTnOC:PTPn/PTPnBOutputcontrolbit
CompareMatchOutputMode
0:initiallow
1:initialhigh
PWMMode/SinglePulseOutputMode
0:Activelow
1:Activehigh
ThisistheoutputcontrolbitfortheTMoutputpin.ItsoperationdependsuponwhetherTMis
beingusedintheCompareMatchOutputModeorinthePWMMode/SinglePulseOutputMode.
IthasnoeffectiftheTMisintheTimer/CounterMode.IntheCompareMatchOutputMode
itdeterminesthelogicleveloftheTMoutputpinbeforeacomparematchoccurs.InthePWM
ModeitdeterminesifthePWMsignalisactivehighoractivelow.
Bit2 PTnPOL:PTPn/PTPnBOutputpolarityControl
0:non-invert
1:invert
ThisbitcontrolsthepolarityofthePTPn/PTPnBoutputpin.WhenthebitissethightheTM
outputpinwillbeinvertedandnotinvertedwhenthebitiszero.IthasnoeffectiftheTMisin
theTimer/CounterMode.
Bit1 PTnCKS:PTMcapturetriggersourceselect
0:FromPTPnI
1:FromPTCKnpin
Bit0 PTnCCLR:SelectPTMCounterclearcondition
0:PTMComparatrorPmatch
1:PTMComparatrorAmatch
Thisbitisusedtoselectthemethodwhichclearsthecounter.RememberthatthePeriodicTM
containstwocomparators,ComparatorAandComparatorP,either ofwhichcanbeselectedto
cleartheinternalcounter.WiththePTnCCLRbitsethigh,thecounterwillbeclearedwhena
comparematchoccursfromtheComparatorA.Whenthebitislow,thecounterwillbecleared
whenacomparematchoccursfromtheComparator Porwithacounteroverflow.Acounter
overowclearingmethodcanonlybeimplementediftheCCRPbitsareallclearedtozero.The
PTnCCLRbitisnotusedinthePWM,SinglePulseorInputCaptureMode.