EasyManua.ls Logo

Holtek HT66F0175 - Comparators; Comparator Operation; Comparator Interr�Pt; Pro�Rammin� Considerations

Default Icon
207 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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
AnanalogcomparatoriscontainedonlywithintheHT66F0185device.Thecomparatorfunction
offersexibilityviatheirregistercontrolledfeaturessuchaspower-down,polarityselect,hysteresis
etc.InsharingtheirpinswithnormalI/OpinsthecomparatorsdonotwastepreciousI/Opinsif
therefunctionsareotherwiseunused.


 

 
  
Comparator
Comparator Operation
TheHT66F0185devicecontainsacomparatorfunctionwhichisusedtocomparetwoanalog
voltagesandprovideanoutputbasedontheirdifference.Fullcontrolovertheinternalcomparatoris
providedviathecontrolregisterCPCassignedtothecomparator.Thecomparatoroutputisrecorded
viaabitinthecontrolregister,butcanalsobetransferredoutontoasharedI/Opin.Additional
comparatorfunctionsincludeoutputpolarity,hysteresisfunctionsandpowerdowncontrol.
Anypull-highresistorsconnectedtothesharedcomparatorinputpinswillbeautomatically
disconnectedwhenthecomparatorisenabled.Asthecomparatorinputsapproachtheirswitching
level,somespuriousoutputsignalsmaybegeneratedonthecomparatoroutputduetotheslow
risingorfallingnatureoftheinputsignals.Thiscanbeminimisedbyselectingthehysteresis
functionwhichappliesasmallamountofpositivefeedbacktothecomparator.Ideallythe
comparatorshouldswitchatthepointwherethepositiveandnegativeinputssignalsareatthesame
voltagelevel.However,unavoidableinputoffsetsintroducesomeuncertaintieshere.Thehysteresis
function,ifenabled,alsoincreasestheswitchingoffsetvalue.
Comparator Interrupt
Thecomparatorpossessesitsowninterruptfunction.Whenthecomparatoroutputchangesstate,
itsrelevantinterruptagwillbeset,andifthecorrespondinginterruptenablebitisset,thenajump
toitsrelevantinterruptvectorwillbeexecuted.NotethatitisthechangingstateoftheCOUTbit
andnottheoutputpinwhichgeneratesaninterrupt.IfthemicrocontrollerisintheSLEEPorIDLE
ModeandtheComparatorisenabled,theniftheexternalinputlinescausetheComparatoroutputto
changestate,theresultinggeneratedinterruptagwillalsogenerateawake-up.Ifitisrequiredto
disableawake-upfromoccurring,thentheinterruptagshouldberstsethighbeforeenteringthe
SLEEPorIDLEMode.
Programming Considerations
Ifthecomparatorisenabled,itwillremainactivewhenthemicrocontrollerenterstheSLEEPor
IDLEMode,howeverasitwillconsumeacertainamountofpower,theusermaywishtoconsider
disablingitbeforetheSLEEPorIDLEModeisentered.Ascomparatorpinsaresharedwithnormal
I/Opins,theI/Oregistersforthesepinswillbereadaszero(portcontrolregisteris“1”)orreadas
portdataregistervalue(portcontrolregisteris“0”)ifthecomparatorfunctionisenabled.

Table of Contents