Rev. 2.50 98 June 22, 2017 Rev. 2.50 99 June 22, 2017
HT66F20/HT66F30/HT66F40/HT66F50/HT66F60
HT66FU30/HT66FU40/HT66FU50/HT66FU60
A/D Flash MCU with EEPROM
HT66F20/HT66F30/HT66F40/HT66F50/HT66F60
HT66FU30/HT66FU40/HT66FU50/HT66FU60
A/D Flash MCU with EEPROM
Programming Considerations
Withintheuserprogram,oneoftherstthingstoconsiderisportinitialisation.Afterareset,allof
theI/Odataandportcontrolregisterswillbesethigh.ThismeansthatallI/Opinswilldefaultto
aninputstate,thelevelofwhichdependsontheotherconnectedcircuitryandwhetherpull-high
selectionshavebeenchosen.Iftheportcontrolregisters,PAC~PGC,arethenprogrammedtosetup
somepinsasoutputs,theseoutputpinswillhaveaninitialhighoutputvalueunlesstheassociated
portdataregisters,PA~PG,arerstprogrammed.Selectingwhichpinsareinputsandwhichare
outputscanbeachievedbyte-widebyloadingthecorrectvaluesintotheappropriateportcontrol
registerorbyprogrammingindividualbitsintheportcontrolregisterusingthe"SET[m].i"and
"CLR[m].i"instructions.Notethatwhenusingthesebitcontrolinstructions,aread-modify-write
operationtakesplace.Themicrocontrollermustrstreadinthedataontheentireport,modifyitto
therequirednewbitvaluesandthenrewritethisdatabacktotheoutputports.
PortAhastheadditionalcapabilityofprovidingwake-upfunctions.Whenthedeviceisinthe
SLEEPorIDLEMode,variousmethodsareavailabletowakethedeviceup.Oneoftheseisahigh
tolowtransitionofanyofthePortApins.SingleormultiplepinsonPortAcanbesetuptohavethis
function.
Timer Modules – TM
Oneofthemostfundamentalfunctionsinanymicrocontrollerdeviceistheabilitytocontroland
measuretime.ToimplementtimerelatedfunctionseachdeviceincludesseveralTimerModules,
abbreviatedtothenameTM.TheTMsaremulti-purposetimingunitsandservetoprovide
operationssuchasTimer/Counter,InputCapture,CompareMatchOutputandSinglePulseOutput
aswellasbeingthefunctionalunitforthegenerationofPWMsignals.EachoftheTMshaseither
twoorthreeindividualinterrupts.TheadditionofinputandoutputpinsforeachTMensuresthat
usersareprovidedwithtimingunitswithawideandexiblerangeoffeatures.
ThecommonfeaturesofthedifferentTMtypesaredescribedherewithmoredetailedinformation
providedintheindividualCompact,StandardandEnhancedTMsections.
Introduction
ThedevicescontainfromtwotofourTMsdependinguponwhichdeviceisselectedwitheachTM
havingareferencenameofTM0,TM1,TM2andTM3.EachindividualTMcanbecategorised
asacertaintype,namelyCompactTypeTM,StandardTypeTMorEnhancedTypeTM.Although
similarinnature,thedifferentTMtypesvaryintheirfeaturecomplexity.Thecommonfeatures
toalloftheCompact,StandardandEnhancedTMswillbedescribedinthissection,thedetailed
operationregardingeachoftheTMtypeswillbedescribedinseparatesections.Themainfeatures
anddifferencesbetweenthethreetypesofTMsaresummarisedintheaccompanyingtable.
Function CTM STM ETM
Timer/Counter √ √ √
I/P Capture — √ √
Compare Match Output √ √ √
PWM Channels
1 1 2
Single Pulse Output — 1 2
PWM Alignment Edge Edge Edge & Centre
PWM Adjustment Period & Duty Duty or Period Duty or Period Duty or Period
TM Function Summary