Rev. 1.50 146 August 28, 2017 Rev. 1.50 147 August 28, 2017
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
Comparators
AnanalogcomparatoriscontainedonlywithintheHT66F0185device.Thecomparatorfunction
offersexibilityviatheirregistercontrolledfeaturessuchaspower-down,polarityselect,hysteresis
etc.InsharingtheirpinswithnormalI/OpinsthecomparatorsdonotwastepreciousI/Opinsif
therefunctionsareotherwiseunused.
Comparator
Comparator Operation
TheHT66F0185devicecontainsacomparatorfunctionwhichisusedtocomparetwoanalog
voltagesandprovideanoutputbasedontheirdifference.Fullcontrolovertheinternalcomparatoris
providedviathecontrolregisterCPCassignedtothecomparator.Thecomparatoroutputisrecorded
viaabitinthecontrolregister,butcanalsobetransferredoutontoasharedI/Opin.Additional
comparatorfunctionsincludeoutputpolarity,hysteresisfunctionsandpowerdowncontrol.
Anypull-highresistorsconnectedtothesharedcomparatorinputpinswillbeautomatically
disconnectedwhenthecomparatorisenabled.Asthecomparatorinputsapproachtheirswitching
level,somespuriousoutputsignalsmaybegeneratedonthecomparatoroutputduetotheslow
risingorfallingnatureoftheinputsignals.Thiscanbeminimisedbyselectingthehysteresis
functionwhichappliesasmallamountofpositivefeedbacktothecomparator.Ideallythe
comparatorshouldswitchatthepointwherethepositiveandnegativeinputssignalsareatthesame
voltagelevel.However,unavoidableinputoffsetsintroducesomeuncertaintieshere.Thehysteresis
function,ifenabled,alsoincreasestheswitchingoffsetvalue.
Comparator Interrupt
Thecomparatorpossessesitsowninterruptfunction.Whenthecomparatoroutputchangesstate,
itsrelevantinterruptagwillbeset,andifthecorrespondinginterruptenablebitisset,thenajump
toitsrelevantinterruptvectorwillbeexecuted.NotethatitisthechangingstateoftheCOUTbit
andnottheoutputpinwhichgeneratesaninterrupt.IfthemicrocontrollerisintheSLEEPorIDLE
ModeandtheComparatorisenabled,theniftheexternalinputlinescausetheComparatoroutputto
changestate,theresultinggeneratedinterruptagwillalsogenerateawake-up.Ifitisrequiredto
disableawake-upfromoccurring,thentheinterruptagshouldberstsethighbeforeenteringthe
SLEEPorIDLEMode.
Programming Considerations
Ifthecomparatorisenabled,itwillremainactivewhenthemicrocontrollerenterstheSLEEPor
IDLEMode,howeverasitwillconsumeacertainamountofpower,theusermaywishtoconsider
disablingitbeforetheSLEEPorIDLEModeisentered.Ascomparatorpinsaresharedwithnormal
I/Opins,theI/Oregistersforthesepinswillbereadaszero(portcontrolregisteris“1”)orreadas
portdataregistervalue(portcontrolregisteris“0”)ifthecomparatorfunctionisenabled.