
C8051F040/1/2/3/4/5/6/7
Rev. 1.5
309
24.2.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 24.1, where FPCA is the fre- quency of the clock selected by the CPS2-0 bits in the PCA mode register, PCA0MD.
Note: A value of 0x00 in the PCA0CPHn register is equal to 256 for this equation.
The lower byte of the capture/compare module is compared to the PCA0 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. Fre-
quency Output Mode is enabled by setting the ECOMn, TOGn, and PWMn bits in the PCA0CPMn register.
Figure 24.7. PCA Frequency Output Mode
Equation 24.1. Square Wave Frequency Output
F
sqr
F
PCA
2
PCA0CPHn
-----------------------------------------
=
8-bit
Comparator
PCA0L
Enable
PCA Timebase
00 0
0
match
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
0
PCA0CPHn
8-bit Adder
PCA0CPLn
Adder
Enable
CEXn
Crossbar
Port I/O
Toggle
0
1
TOGn
1