beautypg.com

pulse width modulator mode, Preliminary – Rainbow Electronics T89C51CC02 User Manual

Page 108

background image

108

Rev.A - May 17, 2001

Preliminary

T89C51CC02

16.6. Pulse Width Modulator Mode

All the PCA modules can be used as PWM outputs. The output frequency depends on the source for the PCA
timer. All the modules will have the same output frequency because they all share the PCA timer. The duty cycle
of each module is independently variable using the module’s capture register CCAPLn. When the value of the
PCA CL SFR is less than the value in the module’s CCAPLn SFR the output will be low, when it is equal to or
greater than it, the output will be high. When CL overflows from FF to 00, CCAPLn is reloaded with the value
in CCAPHn. the allows the PWM to be updated without glitches. The PWM and ECOM bits in the module’s
CCAPMn register must be set to enable the PWM mode.

Figure 109. PCA PWM Mode

CL rolls over from FFh TO 00h
loads

CCAPnH

contents

into

CCAPnL

CCAPxL

CCAPn

8-Bit

Comparator

CL (8 bits)

“0

“1”

CL < CCAPnL

CL >= CCAPnL

CEX

-

ECOMn0 00

0PWMn0

7

0

CCAPMn Register