EasyManua.ls Logo

Holtek HT66F20 - Page 120

Holtek HT66F20
294 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. 2.50 120 June 22, 2017 Rev. 2.50 121 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
PWM Output Mode
Toselectthismode,bitsTnM1andTnM0intheTMnC1registershouldbesetto10respectively.
ThePWMfunctionwithintheTMisusefulforapplicationswhichrequirefunctionssuchasmotor
control,heatingcontrol,illuminationcontroletc.Byprovidingasignaloffixedfrequencybut
ofvaryingdutycycleontheTMoutputpin,asquarewaveACwaveformcanbegeneratedwith
varyingequivalentDCRMSvalues.
AsboththeperiodanddutycycleofthePWMwaveformcanbecontrolled,thechoiceofgenerated
waveformisextremelyflexible.InthePWMmode,theTnCCLRbithasnoeffectonthePWM
operation.BothoftheCCRAandCCRPregistersareusedtogeneratethePWMwaveform,one
registerisusedtocleartheinternalcounterandthuscontrolthePWMwaveformfrequency,while
theotheroneisusedtocontrolthedutycycle.Whichregisterisusedtocontroleitherfrequency
ordutycycleisdeterminedusingtheTnDPXbitintheTMnC1register.ThePWMwaveform
frequencyanddutycyclecanthereforebecontrolledbythevaluesintheCCRAandCCRPregisters.
Aninterruptag,oneforeachoftheCCRAandCCRP,willbegeneratedwhenacomparematch
occursfromeitherComparatorAorComparatorP.TheTnOCbitintheTMnC1registerisusedto
selecttherequiredpolarityofthePWMwaveformwhilethetwoTnIO1andTnIO0bitsareusedto
enablethePWMoutputortoforcetheTMoutputpintoaxedhighorlowlevel.TheTnPOLbitis
usedtoreversethepolarityofthePWMoutputwaveform.
CTM, PWM Mode, Edge-aligned Mode, TnDPX=0
CCRP 001b 010b 011b 100b 101b 110b 111b 000b
Period
128 256 384 512 640 768 896 1024
Duty CCRA
Iff
SYS
=16MHz,TMclocksourceisf
SYS
/4,CCRP=100bandCCRA=128,
TheCTMPWMoutputfrequency=(f
SYS
/4)/512=f
SYS
/2048=7.8125kHz,duty=128/512=25%.
IftheDutyvaluedenedbytheCCRAregisterisequaltoorgreaterthanthePeriodvalue,thenthe
PWMoutputdutyis100%.
CTM, PWM Mode, Edge-aligned Mode, TnDPX=1
CCRP 001b 010b 011b 100b 101b 110b 111b 000b
Period CCRA
Duty 128 256 384 512 640 768 896 1024
ThePWMoutputperiodisdeterminedbytheCCRAregistervaluetogetherwiththeTMclockwhile
thePWMdutycycleisdenedbytheCCRPregistervalue.

Table of Contents

Related product manuals