Figure 14-2. PCA Timer/Counter
Fosc/12
Fosc/2
To PCA Modules
PCA Interrupt
CH
CL
Timer0 Overflow
16-bit Up Counter
External Input ECI (P1.1)
IDLE
-
CIDL
-
-
-
CPS1
CPS0 ECF
CMOD
CCF5 CCF4 CCF3 CCF2 CCF1
CCF0
CF
CR
CCON
Where, Fosc is the system clock.
CMOD (Address=D9H, PCA Counter Mode Register)
7
6
5
4
3
2
1
0
CIDL
-
-
-
-
CPS1
CPS0
ECF
CIDL: PCA counter Idle control.
CIDL=0 lets the PCA counter continue functioning during Idle mode.
CIDL=1 lets the PCA counter be gated off during Idle mode.
CPS1-CPS0: PCA counter clock source select bits.
0
0
1
1
0
1
0
1
Internal clock, Fosc/12 (Fosc is the system clock.)
Internal clock, Fosc/2
Timer 0 overflow
External clock at the ECI pin.
ECF: Enable PCA counter overflow interrupt.
ECF=1 enables an interrupt when CF bit (in CCON register) is set.
The CCON register shown below contains the run control bit for the PCA and the flags for the PCA timer and
each module. To run the PCA the CR bit (CCON.6) must be set by software. The PCA is shut off by clearing this
bit. The CF bit (CCON.7) is set when the PCA counter overflows and an interrupt will be generated if the ECF bit
in the CMOD register is set. The CF bit can only be cleared by software. CCF0 to CCF5 are the interrupt flags for
module 0 to module 5, respectively, and they are set by hardware when either a match or a capture occurs.
These flags also can only be cleared by software. The PCA interrupt system is shown Figure 14-3.
CCON (Address=D8H, PCA Counter Control Register)
7
6
5
4
3
2
1
0
CF
CR
CCF5
CCF4
CCF3
CCF2
CCF1
CCF0
CF:
PCA Counter Overflow flag. Set by hardware when the counter rolls over. CF flag can generate an
interrupt if bit ECF in CMOD is set. CF may be set by either hardware or software but can only be
cleared by software.
CR:
PCA Counter Run control bit.
Set by software to turn the PCA counter on. Must be cleared by software to turn the PCA counter off.
CCF0~CCF5: PCA Module 0 to Module 5 interrupt flags.
Set by hardware when a match or capture occurs. Must be cleared by software.
MEGAWIN
MPC82G516A Data Sheet
68