Rev. 1.71 88 April 11, 2017 Rev. 1.71 89 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
PTMnRPH Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — D9 D8
R/W — — — — — — R/W R/W
POR — — — — — — 0 0
Bit7~2 Unimplemented,readas"0"
Bit1~0 PTMnRPH:PTMCCRPHighByteRegisterbit1~bit0
PTM10-bitCCRPbit9~bit8
Periodic Type TM Operating Modes
ThePeriodicTypeTMcanoperateinoneofveoperatingmodes,CompareMatchOutputMode,
PWMOutputMode,SinglePulseOutputMode,CaptureInputModeorTimer/CounterMode.The
operatingmodeisselectedusingthePTnM1andPTnM0bitsinthePTMnC1register.
Compare Match Output Mode
Toselectthismode,bitsPTnM1andPTnM0inthePTMnC1register,shouldbeallclearedto
00respectively.Inthismodeoncethecounterisenabledandrunningitcanbeclearedbythree
methods.Theseareacounteroverow,acomparematchfromComparatorAandacomparematch
fromComparatorP.WhenthePTnCCLRbitislow,therearetwowaysinwhichthecountercanbe
cleared.OneiswhenacomparematchoccursfromComparatorP,theotheriswhentheCCRPbits
areallzerowhichallowsthecountertooverow.HereboththePTMAnFandPTMPnFinterrupt
requestagsforComparatorAandComparatorPrespectively,willbothbegenerated.
IfthePTnCCLRbitinthePTMnC1registerishighthenthecounterwillbeclearedwhenacompare
matchoccursfromComparatorA.However,hereonlythePTMAnFinterruptrequestflagwill
begeneratedevenifthevalueoftheCCRPbitsislessthanthatoftheCCRAregisters.Therefore
whenPTnCCLRishighnoPTMPnFinterruptrequestflagwillbegenerated.IntheCompare
MatchOutputMode,theCCRAcannotbesetto“0”.IftheCCRAbitsareallzero,thecounterwill
overowwhenitsreachesitsmaximum10-bit,3FFHex,value,howeverherethePTMAnFinterrupt
requestagwillnotbegenerated.
Asthenameofthemodesuggests,afteracomparisonismade,theTMoutputpin,willchangestate.
TheTMoutputpinconditionhoweveronlychangesstatewhenaPTMAnFinterruptrequestagis
generatedafteracomparematchoccursfromComparatorA.ThePTMPnFinterruptrequestag,
generatedfromacomparematchfromComparatorP,willhavenoeffectontheTMoutputpin.
ThewayinwhichtheTMoutputpinchangesstatearedeterminedbytheconditionofthePTnIO1
andPTnIO0bitsinthePTMnC1register.TheTMoutputpincanbeselectedusingthePTnIO1
andPTnIO0bitstogohigh,togolowortotogglefromitspresentconditionwhenacompare
matchoccursfromComparatorA.TheinitialconditionoftheTMoutputpin,whichissetupafter
thePTnONbitchangesfromlowtohigh,issetupusingthePTnOCbit.NotethatifthePTnIO1,
PTnIO0bitsarezerothennopinchangewilltakeplace.