C8051F80x-83x
232
Rev. 1.0
29.3.4. Frequency Output Mode
Frequency Output Mode produces a programmable-frequency square wave on the module’s associated
CEXn pin. The capture/compare module high byte holds the number of PCA clocks to count before the out-
put is toggled. The frequency of the square wave is then defined by
Equation 29.1.Equation 29.1. Square Wave Frequency Output
Where FPCA is the frequency of the clock selected by the CPS2–0 bits in the PCA mode register,
PCA0MD. The lower byte of the capture/compare module is compared to the PCA counter low byte; on a
match, CEXn is toggled and the offset held in the high byte is added to the matched value in PCA0CPLn.
Frequency Output Mode is enabled by setting the ECOMn, TOGn, and PWMn bits in the PCA0CPMn reg-
ister. The MATn bit should normally be set to 0 in this mode. If the MATn bit is set to 1, the CCFn flag for
the channel will be set when the 16-bit PCA0 counter and the 16-bit capture/compare register for the chan-
nel are equal.
Figure 29.7. PCA Frequency Output Mode
29.3.5. 8-bit through 15-bit Pulse Width Modulator Modes
Each module can be used independently to generate a pulse width modulated (PWM) output on its associ-
ated CEXn pin. The frequency of the output is dependent on the timebase for the PCA counter/timer, and
the setting of the PWM cycle length (8, 9, 10, 11, 12, 13, 14, or 15-bits). For backwards-compatibility with
the 8-bit PWM mode available on other devices, the 8-bit PWM mode operates slightly different than 9, 10,
11, 12, 13, 14, and 15-bit PWM modes. It is important to note that all channels configured for 8-bit
through 15-bit PWM mode will use the same cycle length. For example, it is not possible to configure
one channel for 8-bit PWM mode and another for 11-bit mode. However, other PCA channels can be con-
figured to Pin Capture, High-Speed Output, Software Timer, Frequency Output, or 16-bit PWM mode inde-
pendently.
F
CEXn
F
PCA
2
PCA0CPHn
-----------------------------------------
=
Note: A value of 0x00 in the PCA0CPHn register is equal to 256 for this equation.
8-bit
Comparator
PCA0L
Enable
PCA Timebase
match
PCA0CPHn
8-bit Adder
PCA0CPLn
Adder
Enable
CEXn
Crossbar
Port I/O
Toggle
0
1
TOGn
00 0
x
PCA0CPMn
P
W
M
1
6
n
E
C
O
M
n
E
C
F
n
T
O
G
n
P
W
M
n
C
A
P
n
C
A
P
N
n
M
A
T
n
x
ENB
0
1
Write to
PCA0CPLn
Write to
PCA0CPHn
Reset