PWMusermanual
Author:ZhuXu
Features
• WorkasonePWMoronetimer.
• 16bitsmaincounter.
• PWM/TimercanchoosebetweenWishboneinterfaceclockorexternalclockas
workingclock.
• PWM can choose between dedicated duty cycle input or internalregisteras
sourceofdutycycle.
• Dutycycleandperiodcanbechangedatruntime.
• HostedthroughWishboneslaveinterface.
• Workingclockcanbedownclockedtoatmost1/65535or oforiginal
fr
equency.
)12/(1
16
•
Periodregisteralsoservesastimertargetregisterwhenmoduleisintimermode.
Operations
AlloperationsofthisPWMcoreiscontrolledbymanipulatingregistersinsidethe
corethroughWISHBONEslaveinterface.TheinterfaceisWishboneB4compliant.
PWMmode
Whenmodeselectionbit(ctrlbit1)issetthecoreisinPWMmode.Porto_pwmwill
output PWM signal continuously when main counter enable bit (ctrlbit2)and
PWMsignaloutputenablebit(ctrlbit4)areset.It′speriodis storedinregister
period.SignalscomingfromregisterDCorporti_DCcanbeusedasdutycycle.
Bothperiodanddutycyclearedefinedbynumberofclockcycles. When main
counterenablebitisresetthemaincounterwillstoprunningando_pwmwillstop
changinguntilthemaincounterenablebitissetagainorthecounterlogicisreset
byexternalresetormaincounterresetbit(ctrlbit7).
Timermode
Whenmodeselectionbit(ctrlbit1)isresetthecoreisintimermode.Rightafter
maincounterenablebit(ctrlbit 2) is set the main counter starts to increment.
Whenthenumberstoresinmaincounterreachesorexceedsthenumberstoredin
register period an interrupt is generated and output through o_pwm. Then the
maincounterwillbereset.Ifcontinuousrun(ctrlbit3)isselectedandmaincounter