Pca counter/timer, Table 22.1. pca timebase input options, Figure 22.2. pca counter/timer block diagram – Silicon Laboratories C8051F347 User Manual

Page 256

Advertising
background image

C8051F340/1/2/3/4/5/6/7/8/9/A/B/C/D

256

Rev. 1.3

22.1. 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 into a “snapshot” register; the following PCA0H read accesses this “snapshot” register.
Reading the PCA0L Register first guarantees an accurate reading of the entire 16-bit PCA0 counter.
Reading PCA0H or PCA0L does not disturb the counter operation. The CPS2-CPS0 bits in the PCA0MD
register select the timebase for the counter/timer as shown in Table 22.1.

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 soft-
ware (Note: PCA0 interrupts must be globally enabled before CF interrupts are recognized. PCA0 inter-
rupts 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 CPU is in Idle
mode.

Figure 22.2. PCA Counter/Timer Block Diagram

Table 22.1. PCA Timebase Input Options

CPS2

CPS1

CPS0

Timebase

0

0

0

System clock divided by 12

0

0

1

System clock divided by 4

0

1

0

Timer 0 overflow

0

1

1

High-to-low transitions on ECI (max rate = system clock divided
by 4)

1

0

0

System clock

1

0

1

External oscillator source divided by 8*

*Note: External oscillator source divided by 8 is synchronized with the system clock.

PCA0CN

C

F

C
R

C
C

F
0

C
C

F
2

C
C

F
1

C
C

F
4

C
C

F
3

PCA0MD

C

I

D

L

W

D
T
E

E
C
F

C
P
S

1

C
P
S

0

W

D

L

C
K

C
P
S

2

IDLE

0

1

PCA0H

PCA0L

Snapshot

Register

To SFR Bus

Overflow

To PCA Interrupt System

CF

PCA0L

read

To PCA Modules

SYSCLK/12

SYSCLK/4

Timer 0 Overflow

ECI

000

001

010

011

100

101

SYSCLK

External Clock/8

Advertising
This manual is related to the following products: