Rev. 1.71 98 April 11, 2017 Rev. 1.71 99 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
A/D Converter Control Registers – SADC0, SADC1, SADC2, PASR, PBSR
TocontrolthefunctionandoperationoftheA/Dconverter,severalcontrolregistersknownas
SADC0,SADC1andSADC2areprovided.These8-bitregistersdefinefunctionssuchasthe
selectionofwhichanalogchannelisconnectedtotheinternalA/Dconverter,thedigitiseddata
format,theA/DclocksourceaswellascontrollingthestartfunctionandmonitoringtheA/D
converterbusystatus.TheSACS2~SACS0bitsintheSADC0registerareusedtodeterminewhich
externalchannelinputisselectedtobeconverted.TheSAINS2~SAINS0bitsintheSADC1register
areusedtodeterminethattheanalogsignaltobeconvertedcomesfromtheinternalanalogsignal
orexternalanalogchannelinput.IftheSAINS2~SAINS0bitsaresetto“000”,theexternalanalog
channelinputisselectedtobeconvertedandtheSACS2~SACS0bitscandeterminewhichexternal
channelisselectedtobeconverted.IftheSAINS2~SAINS0bitsaresetto“001~011”,theAV
DD
voltageisselectedtobeconverted.IftheSAINS2~SAINS0bitsaresetto“101~111”,theOPA
outputvoltageisselectedtobeconverted.WhenV
REF
orV
BG
isselectedasADCinputorADC
referencevoltage,theOPAneedstobeenabledbysettingENOPAto1.
Notethatwhentheprograms selectexternalsignalandinternalsignalasanADCinputsignal
simultaneously,thenthehardwarewillonlychoosetheinternalsignalasanADCinput.Inaddition,
iftheprogramsselectexternalreferencevoltageV
REF
andtheinternalreferencevoltageV
BG
asADC
referencevoltage,thenthehardwarewillonlychoosetheinternalreferencevoltageV
BG
asanADC
referencevoltageinput.
Thepin-sharedfunctioncontrolregisters,namedPASRandPBSR,containthecorrespondingpin-
sharedselectionbitswhichdeterminewhichpinsonPortAandPortBareusedasanaloginputs
fortheA/DconverterinputandwhichpinsarenottobeusedastheA/Dconverterinput.When
thepinisselectedtobeanA/Dinput,itsoriginalfunctionwhetheritisanI/Oorotherpin-shared
functionwillberemoved.Inaddition,anyinternalpull-highresistorsconnectedtothesepinswillbe
automaticallyremovedifthepinisselectedtobeanA/Dinput.
• SADC0 Register – HT66F002/HT66F0025/HT66F003
Bit 7 6 5 4 3 2 1 0
Name START ADBZ ENADC ADRFS — — SACS1 SACS0
R/W R/W R R/W R/W — — R/W R/W
POR 0 0 0 0 — — 0 0
Bit7 START:StarttheA/Dconversion
0→1→0:StartA/Dconversion
0→1:ResettheA/DconverterandsetADBZto0
1→0:StartA/DconversionandsetADBZto1
Bit6 ADBZ:ADCbusyag
0:A/Dconversionendedornoconversion
1:A/Disbusy
Bit5 ENADC:ADCenable/disablecontrolregister
0:ADCdisable
1:ADCenable
Bit4 ADRFS:A/Doutputdataformatselectionbit
0:ADCoutputdataformat→SADOH=D[11:4];SADOL=D[3:0]
1:ADCoutputdataformat→SADOH=D[11:8];SADOL=D[7:0]
Bit3~2 Unimplemented,readas"0"
Bit1~0 SACS1~SACS0:ADCinputchannelsselection
00:ADCinputchannelcomesfromAN0
01:ADCinputchannelcomesfromAN1
10:ADCinputchannelcomesfromAN2
11:ADCinputchannelcomesfromAN3