English
Language : 

AT89C51RB2_14 Datasheet, PDF (35/127 Pages) ATMEL Corporation – Variable Length MOVX for Slow RAM/Peripherals
AT89C51RB2/RC2
Figure 12. PCA Interrupt System
PCA Timer/Counter
CF CR
CCON
CCF4 CCF3 CCF2 CCF1 CCF0
0xD8
4180E–8051–10/06
Module 0
Module 1
Module 2
To Interrupt
Priority Decoder
Module 3
Module 4
CMOD. 0 ECF
ECCFn CCAPMn. 0
IEN0. 6 IEN0. 7
EC
EA
PCA Modules: each one of the five compare/capture Modules has six possible func-
tions. It can perform:
• 16-bit Capture, positive-edge triggered
• 16-bit Capture, negative-edge triggered
• 16-bit Capture, both positive and negative-edge triggered
• 16-bit Software Timer
• 16-bit High-speed Output
• 8-bit Pulse Width Modulator
In addition, Module 4 can be used as a Watchdog Timer.
Each Module in the PCA has a special function register associated with it. These regis-
ters are: CCAPM0 for Module 0, CCAPM1 for Module 1, etc. (see Table 24). The
registers contain the bits that control the mode that each Module will operate in.
• The ECCF bit (CCAPMn. 0 where n = 0, 1, 2, 3, or 4 depending on the Module)
enables the CCF flag in the CCON SFR to generate an interrupt when a match or
compare occurs in the associated Module.
• PWM (CCAPMn. 1) enables the pulse width modulation mode.
• The TOG bit (CCAPMn. 2) when set causes the CEX output associated with the
Module to toggle when there is a match between the PCA counter and the Module's
capture/compare register.
• The match bit MAT (CCAPMn. 3) when set will cause the CCFn bit in the CCON
register to be set when there is a match between the PCA counter and the Module's
capture/compare register.
• The next two bits CAPN (CCAPMn. 4) and CAPP (CCAPMn. 5) determine the edge
that a capture input will be active on. The CAPN bit enables the negative edge, and
the CAPP bit enables the positive edge. If both bits are set both edges will be
enabled and a capture will occur for either transition.
• The last bit in the register ECOM (CCAPMn. 6) when set enables the comparator
function.
Table 24 shows the CCAPMn settings for the various PCA functions.
35