BS85B12-3/BS85C20-3/BS85C20-5
Touch Key Flash MCU with LCD/LED Driver
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ꢀCCRAꢀandꢀCCRPꢀregistersꢀ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ꢀflag,ꢀoneꢀforꢀeachꢀofꢀtheꢀCCRAꢀandꢀCCRP,ꢀwillꢀbeꢀgeneratedꢀwhenꢀaꢀcompareꢀmatchꢀ
occursꢀfromꢀeitherꢀComparatorꢀAꢀorꢀ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ꢀfixedꢀhighꢀorꢀlowꢀlevel.ꢀTheꢀTnPOLꢀbitꢀisꢀ
usedꢀtoꢀreverseꢀtheꢀpolarityꢀofꢀtheꢀPWMꢀoutputꢀwaveform.
Coꢀnter Valꢀe
Coꢀnter Cleared
by CCRP
TnDPX = 0; TnM [1:0] = 10
CCRP
CCR�
Coꢀnter reset
when TnON
retꢀrns hiꢁh
Coꢀnter Stop
if TnON bit low
Paꢀse Resꢀme
Time
TnON
TnP�U
TnPOL
CCR� Int.
Flaꢁ Tn�F
CCRP Int.
Flaꢁ TnPF
TM O/P Pin
TnOC = 1
TM O/P Pin
TnOC = 0
PWM resꢀmes
operation
Oꢀtpꢀt controlled by
other pin-shared fꢀnction
PWM Dꢀty Cycle
set by CCR�
Oꢀtpꢀt Inverts
When TnPOL = 1
PWM Period
set by CCRP
PWM Mode – TnDPX = 0
Note:ꢀ1.ꢀHereꢀTnDPX=0ꢀ--ꢀCounterꢀclearedꢀbyꢀCCRP
2.ꢀAꢀcounterꢀclearꢀsetsꢀtheꢀPWMꢀPeriod
3.ꢀTheꢀinternalꢀPWMꢀfunctionꢀcontinuesꢀevenꢀwhenꢀTnIOꢀ[1:0]ꢀ=ꢀ00ꢀorꢀ01
4.ꢀTheꢀTnCCLRꢀbitꢀhasꢀnoꢀinfluenceꢀonꢀPWMꢀoperation
Rev. 1.20
80
�ꢀꢁꢀst 10ꢂ 2012