EasyManua.ls Logo

Holtek BS82B12A-3 - PWM O�Tp�T Mode

Holtek BS82B12A-3
168 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. 1.20 92 January 23, 2015 Rev. 1.20 93 January 23, 2015
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
Timer/Counter Mode
Toselectthismode,bitsPT0M1andPT0M0inthePTM0C1registershouldbesetto11
respectively.TheTimer/CounterModeoperatesinanidenticalwaytotheCompareMatchOutput
Modegeneratingthesameinterruptflags.TheexceptionisthatintheTimer/CounterModethe
PTM0outputpinisnotused.ThereforetheabovedescriptionandTimingDiagramsfortheCompare
MatchOutputModecanbeusedtounderstanditsfunction.
PWM Output Mode
Toselectthismode,bitsPT0M1andPT0M0inthePTM0C1registershouldbesetto10
respectively.ThePWMfunctionwithinthePTM0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PTM0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exible.InthePWMOutputMode,thePT0CCLR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.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PT0OCbitinthePTM0C1registerisused
toselecttherequiredpolarityofthePWMwaveformwhilethetwoPT0IO1andPT0IO0bitsare
usedtoenablethePWMoutputortoforcethePTM0outputpintoaxedhighorlowlevel.The
PT0POLbitisusedtoreversethepolarityofthePWMoutputwaveform.
10-bit PTM, PWM Mode, Edge-aligned Mode
CCRP 1~1023 0
Period 1~1023 1024
Duty CCRA
Iff
SYS
=16MHz,PTM0clocksourceselectf
SYS
/4,CCRP=512andCCRA=128,
ThePTM0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%.

Table of Contents

Related product manuals