Rev. 1.71 74 April 11, 2017 Rev. 1.71 75 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
Standard Type TM Operating Modes
TheStandardTypeTMcanoperateinoneofveoperatingmodes,CompareMatchOutputMode,
PWMOutputMode,SinglePulseOutputMode,CaptureInputModeorTimer/CounterMode.The
operatingmodeisselectedusingtheST0M1andST0M0bitsintheSTM0C1register.
Compare Output Mode
Toselectthismode,bitsST0M1andST0M0intheSTM0C1register,shouldbesetto00
respectively.Inthismodeoncethecounterisenabledandrunningitcanbeclearedbythree
methods.Theseareacounteroverow,acomparematchfromComparatorAandacomparematch
fromComparatorP.WhentheST0CCLRbitislow,therearetwowaysinwhichthecountercanbe
cleared.OneiswhenacomparematchfromComparatorP,theotheriswhentheCCRPbitsareall
zerowhichallowsthecountertooverow.HerebothSTMA0FandSTMP0Finterruptrequestags
forComparatorAandComparatorPrespectively,willbothbegenerated.
IftheST0CCLRbitintheSTM0C1registerishighthenthecounterwillbeclearedwhenacompare
matchoccursfromComparatorA.However,hereonlytheSTMA0Finterruptrequestflagwill
begeneratedevenifthevalueoftheCCRPbitsislessthanthatoftheCCRAregisters.Therefore
whenST0CCLRishighnoSTMP0Finterruptrequestflagwillbegenerated.IntheCompare
MatchOutputMode,theCCRAcannotbesetto"0".IftheCCRAbitsareallzero,thecounterwill
overowwhenitsreachesitsmaximum10-bit,3FFHex,value,howeverheretheSTMA0Finterrupt
requestagwillnotbegenerated.
Asthenameofthemodesuggests,afteracomparisonismade,theSTMoutputpin,willchange
state.TheSTMoutputpinconditionhoweveronlychangesstatewhenanSTMA0Finterruptrequest
agisgeneratedafteracomparematchoccursfromComparatorA.TheSTMP0Finterruptrequest
ag,generatedfromacomparematchoccursfromComparatorP,willhavenoeffectontheSTM
outputpin.ThewayinwhichtheSTMoutputpinchangesstatearedeterminedbytheconditionof
theST0IO1andST0IO0bitsintheSTM0C1register.TheSTMoutputpincanbeselectedusing
theST0IO1andST0IO0bitstogohigh,togolowortotogglefromitspresentconditionwhena
comparematchoccursfromComparatorA.TheinitialconditionoftheSTMoutputpin,whichis
setupaftertheST0ONbitchangesfromlowtohigh,issetupusingtheST0OCbit.Notethatifthe
ST0IO1andST0IO0bitsarezerothennopinchangewilltakeplace.