C8051F000/1/2/5/6/7
C8051F010/1/2/5/6/7
20.2. PCA Counter/Timer
The 16-bit PCA counter/timer consists of two 8-bit SFRs: PCA0L and PCA0H. PCA0H is the high byte (MSB) of
the 16-bit counter/timer and PCA0L is the low byte (LSB). Reading PCA0L automatically latches the value of
PCA0H at the same time. By reading the PCA0L Register first, this allows the PCA0H value to be held (at the time
PCA0L was read) until the user reads the PCA0H Register. Reading PCA0H or PCA0L does not disturb the
counter operation. The CPS1 and CPS0 bits in the PCA0MD register select the timebase for the counter/timer as
shown in Table 20.2.
When the counter/timer overflows from 0xFFFF to 0x0000, the Counter Overflow Flag (CF) in PCA0MD is set to
logic 1 and an interrupt request is generated if CF interrupts are enabled. Setting the ECF bit in PCA0MD to logic 1
enables the CF flag to generate an interrupt request. The CF bit is not automatically cleared by hardware when the
CPU vectors to the interrupt service routine, and must be cleared by software. (Note: PCA0 interrupts must be
globally enabled before CF interrupts are recognized. PCA0 interrupts are globally enabled by setting the EA bit
(IE.7) and the EPCA0 bit in EIE1 to logic 1.) Clearing the CIDL bit in the PCA0MD register allows the PCA to
continue normal operation while the microcontroller core is in Idle mode.
Table 20.2. PCA Timebase Input Options
CPS1
0
0
1
1
CPS0
0
1
0
1
Timebase
System clock divided by 12
System clock divided by 4
Timer 0 overflow
High-to-low transitions on ECI (max rate = system clock divided by 4)
Figure 20.7. PCA Counter/Timer Block Diagram
IDLE
PCA0MD
C
CCE
I
PPC
D
SSF
L
10
PCA0CN
CC CCCCC
FR CCCCC
FFFFF
43210
SYSCLK/12
00
SYSCLK/4
01
Timer 0 Overflow
10
ECI
11
PCA0L
read or
write
Snapshot
Register
To SFR Bus
0
PCA0H
PCA0L
Overflow
To PCA Interrupt System
1
CF
To PCA Modules
159
Rev. 1.7