STC12C5Axx
Technical Summary
45
Programmable Counter Array (PCA)
The Programmable Counter Array is a special 16-bit Timer that has two 16-bit capture/compare modules
associated with it. Each of the modules can be programmed to operate in one of four modes:
z
rising and/or falling edge capture (calculator of duty length for high/low pulse)
z
software
timer
z
high-speed
output
z
pulse
width
modulator
Each module has a pin associated with it in port 1. Module-0 is connected to pin P1.3, module-1 to pin
P1.4.
The PCA timer is a common time base for all two modules and can be programmed to run at 1/12 the
oscillator frequency, 1/2 the oscillator frequency, the Timer-0 overflow or the input on pin ECI (P3.4). The
timer count source is determined from
CPS1
and
CPS0
bits in the SFR
CMOD
.
Module-0
Capture/Compare
Register
Module-1
Capture/Compare
Register
PCA
Timer/Counter
16 Bit
P1.3/CEX0/
PCA0/PWM0
P1.4/CEX1/
PCA1/PWM1
Programmable Counter Array
In the
CMOD
SFR, there are two additional bits associated with the PCA. On of them is
CIDL
which
determines if to stop the PCA while the MCU is put under idle, the other bit is
ECF
which controls if to
pass the interrupt from PCA into the MCU.
The
CCON
SFR contains the run control bit for PCA and several flags for the PCA timer and each
module. To start the PCA counting, the
CR
bit (
CCON
.6) must be set by software; oppositely clearing bit
CR will shut off the PCA. There is a bit named
CF
in SFR
CCON
. The
CF
bit (
CCON
.7) will be set when
the PCA timer overflows, and an interrupt will be generated if the
ECF
(
CMOD
.0) is set. The
CF
bit can
only be cleared by software. There are two bits named CCF0 and
CCF1
in SFR
CCON
. The
CCF0
and
CCF1
serve as flags for module-0 and module-1 respectively. They are set by hardware when either a
match or a capture occurs. These flags also can only be cleared by software.
http://www.DataSheet4U.net/
datasheet pdf - http://www.DataSheet4U.net/