STC8A8K64D4 Series Manual
CCAPNn: PCAn Capture on falling edge enable bit
MATn: PCAn match function enable bit
TOGn: PCAn high speed pulse output function enable bit
PWMn: PCAn PWM output function enable bit
ECCFn: PCAn match/capture interrupt enable bit
18.2.5 PCA capture value/compare value registers (CCAPnL, CCAPnH)
Symbol
Address
CCAP0L
EAH
CCAP1L
EBH
CCAP2L
ECH
CCAP3L
FD55H
CCAP0H
FAH
CCAP1H
FBH
CCAP2H
FCH
CCAP3H
FD56H
When the PCA capture function is enabled, CCAPnL and CCAPnH are used to save the count value (CL and CH) of
the PCA at the time of capture. When the PCA comparison function is enabled, the PCA controller compares the
current value in [CH,CL] and the value in [CCAPnH, CCAPnL], and the comparison result is given. When the
PCA match function is enabled, the PCA controller compares the current value in [CH, CL] with the value stored
in [CCAPnH, CCAPnL], and checks if they match (equal), then gives a match result.
18.2.6 PCA PWM mode control registers (PCA_PWMn)
Symbol
Address
PCA_PWM0
F2H
PCA_PWM1
F3H
PCA_PWM2
F4H
PCA_PWM3
FD57H
EBSn[1:0]: PCAn PWM number of bits control
EBSn[1:0]
PWM bits
00
8-bits PWM
01
7-bits PWM
10
6-bits PWM
11
10-bits PWM
XCCAPnH[1:0]: The 9
XCCAPnL[1:0]: The 9
EPCnH: The MSB of reload vaule in PWM mode (i.e. the 9
bit of 6-bit PWM, the 11
EPCnL: The MSB of comparison vaule in PWM mode (i.e. the 9
7
th
bit of 6-bit PWM, the 11
Note: When updating the reload value of 10-bit PWM, write the upper two bits of XCCAPnH [1: 0] firstly and
then the lower 8 bits of CCAPnH [7: 0].
18.3 PCA Operation Mode
There are 4 groups of PCA modules in STC12Hseries of microcontrollers, and operation mode of each module can be
set independently. The mode settings are as follows:
-
ECOMn
CAPPn
CAPNn
-
0
0
-
1
0
-
1
1
-
1
0
B7
B6
B7
B6
EBS0[1:0]
EBS1[1:0]
EBS2[1:0]
EBS3[1:0]
Reload value
{EPCnH, CCAPnH[7:0]}
{EPCnH, CCAPnH[6:0]}
{EPCnH, CCAPnH[5:0]}
{EPCnH, XCCAPnH[1:0], CCAPnH[7:0]}
th
th
bit and 10
bit of reload value of 10-bit PWM
th
th
bit and 10
bit of comparison value of 10-bit PWM
th
bit of 10-bit PWM)
th
bit of 10-bit PWM)
CCAPMn
MATn
TOGn
PWMn
0
0
0
0
0
0
0
0
0
1
0
0
B5
B4
B3
B5
B4
B3
XCCAP0H[1:0]
XCCAP0L[1:0]
XCCAP1H[1:0]
XCCAP1L[1:0]
XCCAP2H[1:0]
XCCAP2L[1:0]
XCCAP3H[1:0]
XCCAP3L[1:0]
Comparison value
{EPCnL, CCAPnL[7:0]}
{EPCnL, CCAPnL[6:0]}
{EPCnL, CCAPnL[5:0]}
{EPCnL, XCCAPnL[1:0], CCAPnL[7:0]}
th
bit of 8-bit PWM, the 8
th
bit of 8-bit PWM, the 8
ECCFn
0
0
1
0
6/7/8/10 bit PWM mode, no interrupt
6/7/8/10 bit PWM mode, rising edge
1
1
interrupt
1
1
6/7/8/10 bit PWM mode, falling edge
B2
B1
B2
B1
EPC0H
EPC0L
EPC1H
EPC1L
EPC2H
EPC2L
EPC3H
EPC3L
th
bit of 7-bit PWM, the 7
th
bit of 7-bit PWM, the
Function of module
No operation
B0
B0
th
- 519 -
Need help?
Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?