Rev. 1.50 70 August 28, 2017 Rev. 1.50 71 August 28, 2017
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
A/D Input/Output Structure
Programming Considerations
Withintheuserprogram,oneofthethingsrsttoconsiderisportinitialisation.Afterareset,all
oftheI/Odataandportcontrolregisterswillbesettohigh.ThismeansthatallI/Opinswillbe
defaultedtoaninputstate,thelevelofwhichdependsontheotherconnectedcircuitryandwhether
pull-highselectionshavebeenchosen.Iftheportcontrolregistersarethenprogrammedtosetup
somepinsasoutputs,theseoutputpinswillhaveaninitialhighoutputvalueunlesstheassociated
portdataregistersarerstprogrammed.Selectingwhichpinsareinputsandwhichareoutputscan
beachievedbyte-widebyloadingthecorrectvaluesintotheappropriateportcontrolregisteror
byprogrammingindividualbitsintheportcontrolregisterusingthe“SET[m].i”and“CLR[m].i”
instructions.Notethatwhenusingthesebitcontrolinstructions,aread-modify-writeoperationtakes
place.Themicrocontrollermustrstreadinthedataontheentireport,modifyittotherequirednew
bitvaluesandthenrewritethisdatabacktotheoutputports.
Thepower-onresetconditionoftheA/DconvertercontrolregistersensuresthatanyA/Dinput
pins,whicharealwayssharedwithotherI/Ofunctions,willbesetupasanaloginputsafterareset.
AlthoughthesepinswillbeconguredasA/Dinputsafterareset,theA/Dconverterwillnotbe
switchedon.ItisthereforeimportanttonotethatifitisrequiredtousethesepinsasI/Odigital
inputpinsorasotherfunctions,theA/Dconvertercontrolregistersmustbecorrectlyprogrammed
toremovetheA/Dfunction.NotealsothatastheA/Dchannelisenabled,anyinternalpull-high
resistorconnectionswillberemoved.
PortAhastheadditionalcapabilityofprovidingwake-upfunctions.Whenthedevicesareinthe
SLEEPorIDLEMode,variousmethodsareavailabletowakethedevicesup.Oneoftheseisahigh
tolowtransitionofanyofthePortApins.SingleormultiplepinsonPortAcanbesetuptohavethis
function.