P89LV51RB2_RC2_RD2_5 © NXP B.V. 2009. All rights reserved.
Product data sheet Rev. 05 — 15 December 2009 49 of 76
NXP Semiconductors
P89LV51RB2/RC2/RD2
8-bit microcontrollers with 80C51 core
Table 37. CMOD - PCA counter mode register (address D9H) count pulse select
CPS1 CPS0 Select PCA input
0 0 0 Internal clock, f
osc
/ 6
0 1 1 Internal clock, f
osc
/ 2
1 0 2 Timer 0 overflow
1 1 3 External clock at ECI/P1.2 pin (maximum rate = f
osc
/ 4)
Table 38. CCON - PCA counter control register (address 0D8H) bit allocation
Bit addressable; reset value: 00H.
Bit 7 6 5 4 3 2 1 0
Symbol CF CR - CCF4 CCF3 CCF2 CCF1 CCF0
Table 39. CCON - PCA counter control register (address 0D8H) bit descriptions
Bit Symbol Description
7 CF PCA Counter Overflow Flag. Set by hardware when the counter rolls
over. CF flags 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.
6 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.
5 - Reserved for future use. Should be set to
‘0’ by user programs.
4 CCF4 PCA Module 4 Interrupt Flag. Set by hardware when a match or
capture occurs. Must be cleared by software.
3 CCF3 PCA Module 3 Interrupt Flag. Set by hardware when a match or
capture occurs. Must be cleared by software.
2 CCF2 PCA Module 2 Interrupt Flag. Set by hardware when a match or
capture occurs. Must be cleared by software.
1 CCF1 PCA Module 1 Interrupt Flag. Set by hardware when a match or
capture occurs. Must be cleared by software.
0 CCF0 PCA Module 0 Interrupt Flag. Set by hardware when a match or
capture occurs. Must be cleared by software.
Table 40. CCAPMn - PCA modules compare/capture register (address CCAPM0: 0DAH,
CCAPM1: 0DBH, CCAPM2: 0DCH, CCAPM3: 0DDH, CCAPM4: 0DEH) bit
allocation
Not bit addressable; reset value: 00H.
Bit 7 6 5 4 3 2 1 0
Symbol - ECOMn CAPPn CAPNn MATn TOGn PWMn ECCFn
Table 41. CCAPMn - PCA modules compare/capture register (address CCAPM0:
0DAH,
CCAPM1: 0DBH, CCAPM2: 0DCH, CCAPM3: 0DDH, CCAPM4: 0DEH) bit
descriptions
Bit Symbol Description
7 - Reserved for future use. Should be set to ‘0’ by user programs.
6 ECOMn Enable Comparator. ECOMn = 1 enables the comparator function.
5 CAPPn Capture Positive, CAPPn = 1 enables positive edge capture.
4 CAPNn Capture Negative, CAPNn = 1 enables negative edge capture.
P89LV51RB2_RC2_RD2_5 © NXP B.V. 2009. All rights reserved.
Product data sheet Rev. 05 — 15 December 2009 50 of 76
NXP Semiconductors
P89LV51RB2/RC2/RD2
8-bit microcontrollers with 80C51 core
6.9.1 PCA capture mode
To use one of the PCA modules in the capture mode (Figure 22) either one or both of the
CCAPM bits CAPNn and CAPPn for that module must be set. The external CEX input for
the module (on port 1) is sampled for a transition. When a valid transition occurs the PCA
hardware loads the value of the PCA counter registers (CH and CL) into the module’s
capture registers (CCAPnL and CCAPnH).
3 MATn Match. When MATn = 1 a match of the PCA counter with this module’s
compare/capture register causes the CCFn bit in CCON to be set,
flagging an interrupt.
2 TOGn Toggle. When TOGn = 1, a match of the PCA counter with this
module’s compare/capture register causes the CEXn pin to toggle.
1 PWMn Pulse Width Modulation mode. PWMn = 1 enables the CEXn pin to be
used as a pulse-width modulated output.
0 ECCFn Enable CCF Interrupt. Enables compare/capture flag CCFn in the
CCON register to generate an interrupt.
Table 41. CCAPMn - PCA modules compare/capture register (address CCAPM0:
0DAH,
CCAPM1: 0DBH, CCAPM2: 0DCH, CCAPM3: 0DDH, CCAPM4: 0DEH) bit
descriptions
…continued
Bit Symbol Description
Table 42. PCA module modes (CCAPMn register)
ECOMn CAPPn CAPNn MATn TOGn PWMn ECCFn Module function
0 0 0 0 0 0 0 no operation
X 1 0 0 0 0 X 16-bit capture by a positive-edge trigger on
CEXn
X 0 1 0 0 0 X 16-bit capture by a negative-edge trigger on
CEXn
X 1 1 0 0 0 X 16-bit capture by any transition on CEXn
1 0 0 1 0 0 X 16-bit software timer
1 0 0 1 1 0 X 16-bit high-speed output
1 0 0 0 0 1 0 8-bit PWM
1 0 0 1 X 0 X Watchdog timer
P89LV51RB2_RC2_RD2_5 © NXP B.V. 2009. All rights reserved.
Product data sheet Rev. 05 — 15 December 2009 51 of 76
NXP Semiconductors
P89LV51RB2/RC2/RD2
8-bit microcontrollers with 80C51 core
If the CCFn bit for the module in the CCON SFR and the ECCFn bit in the CCAPMn SFR
are set then an interrupt will be generated.
6.9.2 16-bit software timer mode
The PCA modules can be used as software timers (Figure 23) by setting both the ECOMn
and MATn bits in the modules CCAPMn register. The PCA timer will be compared to the
module’s capture registers and when a match occurs an interrupt will occur if the CCFn
(CCON SFR) and the ECCFn (CCAPMn SFR) bits for the module are both set.
Fig 22. PCA capture mode
002aaa538
CF CR - CCF4 CCF3 CCF2 CCF1 CCF0
CCON
(D8H)
PCA
interrupt
PCA timer/counter
- ECOMn
0 000
CAPPn CAPNn MATn TOGn PWMn ECCFn
CCAPMn, n = 0 to 4
(DAH to DEH)
CH CL
CCAPnH CCAPnL
capture
(to CCFn)
CEXn

P89LV51RD2BN,112

Mfr. #:
Manufacturer:
NXP Semiconductors
Description:
IC MCU 8BIT 64KB FLASH 40DIP
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union