Rev. 1.50 124 August 28, 2017 Rev. 1.50 125 August 28, 2017
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
A/D Input Pins
AlloftheA/Danaloginputpinsarepin-sharedwiththeI/Opinsaswellasotherfunctions.The
correspondingpin-sharedfunctionselectionbitsintheACERLregisterdeterminewhichexternal
inputpinsareselectedasA/Dconverteranalogchannelinputsorotherfunctionalpins.Ifthe
correspondingpinissetuptobeanA/Dconverteranalogchannelinput,theoriginalpinfunctions
willbedisabled.Inthisway,pinscanbechangedunderprogramcontroltochangetheirfunction
betweenA/Dinputsandotherfunctions.Allpull-highresistors,whicharesetupthroughregister
programming,willbeautomaticallydisconnectedifthepinsaresetupasA/Dinputs.Notethatit
isnotnecessarytorstsetuptheA/DpinasaninputintheportcontrolregistertoenabletheA/D
inputaswhentherelevantA/DinputfunctionselectionbitsenableanA/Dinput,thestatusofthe
portcontrolregisterwillbeoverridden.
TheA/Dconverterhasitsownreferencevoltageinputpin,VREFI.However,thereferencevoltage
canalsobesuppliedfromthepowersupplypinoraninternalBandgapcircuit,achoicewhich
ismadethroughtheSAVRS3~SAVRS0bitsintheSADC2register.TheselectedA/Dreference
voltagecanbeoutputontheVREFpin.Theanaloginputvaluesmustnotbeallowedtoexceedthe
valueofV
REF
.NotethattheVREFIorVREFpinfunctionselectionbitintheSADC2registermust
beproperlyconguredbeforethereferencevoltagepinfunctionisused.
A/D Reference Voltage
ThereferencevoltagesupplytotheA/DConvertercanbesuppliedfromthepositivepowersupply
pin,V
DD
,anexternalreferencesourcesuppliedonpinVREFIoraninternalreferencesourcederived
fromtheBandgapcircuit.Thentheselectedreferencevoltagesourcecanbeampliedthrougha
programmablegainamplierexceptthevoltagesourcedfromV
DD
.ThePGAgaincanbeequalto
1,2,3or4.ThedesiredselectionismadeusingtheSAVRS3~SAVRS0bitsintheSADC2register
andrelevantpin-sharedfunctionselectionbits.Notethatthedesiredselectedreferencevoltagewill
beoutputontheVREFpinwhichispin-sharedwithotherfunctions.AstheVREFIandVREFpins
botharepin-sharedwithotherfunctions,whentheVREFIorVREFpinisselectedasthereference
voltagesupplypin,theVREFIorVREFpin-sharedfunctionselectionbitshouldbeproperly
conguredtodisableotherpin-sharedfunctions.
A/D Operation
TheSTARTbitintheSADC0registerisusedtostarttheADconversion.Whenthemicrocontroller
setsthisbitfromlowtohighandthenlowagain,ananalogtodigitalconversioncyclewillbe
initiated.
TheADBZbitintheSADC0registerisusedtoindicatewhethertheanalogtodigitalconversion
processisinprogressornot.Thisbitwillbeautomaticallysetto1bythemicrocontrollerafteran
A/Dconversionissuccessfullyinitiated.WhentheA/Dconversioniscomplete,theADBZwillbe
clearedto0.Inaddition,thecorrespondingA/Dinterruptrequestagwillbesetintheinterrupt
controlregister,andifthecorrespondinginterruptcontrolbitsareenabled,aninternalinterrupt
signalwillbegenerated.ThisA/Dinternalinterruptsignalwilldirecttheprogramflowtothe
associatedA/Dinternalinterruptaddressforprocessing.IftheA/Dinternalinterruptisdisabled,the
microcontrollercanpolltheADBZbitintheSADC0registertocheckwhetherithasbeencleared
asanalternativemethodofdetectingtheendofanA/Dconversioncycle.