beautypg.com

High speed output mode, Pulse width modulator mode – Rainbow Electronics T89C5115 User Manual

Page 71

background image

71

T89C5115

4128A–8051–04/02

High Speed Output Mode

In this mode the CEX output (on port 1) associated with the PCA module will toggle
each time a match occurs between the PCA counter and the module’s capture registers.
To activate this mode the TOG, MAT, and ECOM bits in the module’s CCAPMn SFR
must be set.

Figure 34. PCA High Speed Output Mode

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 with-
out glitches. The PWM and ECOM bits in the module’s CCAPMn register must be set to
enable the PWM mode.

CH

CL

CCAPnH

CCAPnL

ECOMn

CCAPMn, n = 0 to 1

0xDA to 0xDE

CAPNn MATn TOGn PWMn ECCFn

CAPPn

16 bit comparator

Match

CF

CR

CCON

0xD8

CCF1

CCF0

PCA IT

Enable

CEXn

PCA counter/timer

“1”

“0”

Write to

CCAPnL

Reset

Write to

CCAPnH