P89CV51RB2_RC2_RD2_3 © NXP B.V. 2009. All rights reserved.
Product data sheet Rev. 03 — 25 August 2009 43 of 76
NXP Semiconductors
P89CV51RB2/RC2/RD2
80C51 with 1 kB RAM, SPI
6.8 Watchdog timer
The WDT is intended as a recovery method in situations where the CPU may be
subjected to software upset. The WDT consists of a 14-bit counter and the WatchDog
Timer Reset (WDTRST) SFR. The WDT is disabled at reset. To enable the WDT, the user
must write 01EH and 0E1H, in sequence, to the WDTRST SFR. When the WDT is
enabled, it will increment every machine cycle while the oscillator is running. There is no
Table 30. SPSR - SPI Status Register (address AAH) bit allocation
Reset source(s): any reset; reset value: 0000 0000B.
Bit 7 6 5 4 3 2 1 0
Symbol SPIF WCOL - - - - - -
Table 31. SPSR - SPI Status Register (address AAH) bit description
Bit Symbol Description
7 SPIF SPI interrupt flag. Upon completion of data transfer, this bit is set to 1.
If SPIE = 1 and ES = 1, an interrupt is then generated. This bit is
cleared by software.
6 WCOL Write Collision flag. Set if the SPI data register is written to during data
transfer. This bit is cleared by software.
5 to 0 - Reserved for future use. Should be set to 0 by user programs.
Fig 17. SPI transfer format with CPHA = 0
Fig 18. SPI transfer format with CPHA = 1
002aaa529
SCK cycle #
(for reference)
SCK (CPOL = 0)
SCK (CPOL = 1)
MOSI
(from master)
MISO
(from slave)
SS (to slave)
12345678
MSB654321LSB
MSB
654321LSB
002aaa530
MSB
SCK cycle #
(for reference)
SCK (CPOL = 0)
SCK (CPOL = 1)
MOSI
(from master)
MISO
(from slave)
SS (to slave)
6
12345678
5
MSB654321 LSB
4 3 2 1 LSB
P89CV51RB2_RC2_RD2_3 © NXP B.V. 2009. All rights reserved.
Product data sheet Rev. 03 — 25 August 2009 44 of 76
NXP Semiconductors
P89CV51RB2/RC2/RD2
80C51 with 1 kB RAM, SPI
way to disable the WDT, except through a reset (either a hardware reset or a WDT
overflow reset). When the WDT overflows, it will drive an output reset HIGH pulse at the
RST pin.
When the WDT is enabled (and thus running) the user needs to reset it by writing 01EH
and 0E1H, in sequence, to the WDTRST SFR to avoid WDT overflow. The 14-bit counter
reaches overflow when it reaches 16383 (3FFFH) and this will reset the device.
The WDT’s counter cannot be read or written. When the WDT overflows it will generate an
output pulse at the RST pin with a duration of 98 oscillator periods in 6-clock mode or 196
oscillator periods in 12-clock mode.
6.9 PCA
The PCA includes a special 16-bit timer that has five 16-bit capture/compare modules
associated with it. Each of the modules can be programmed to operate in one of four
modes: rising and/or falling edge capture, software timer, high-speed output, or
pulse-width modulator. Each module has a pin associated with it: Module 0 is connected
to CEX0, module 1 to CEX1, etc. Registers CH and CL contain the current value of the
free-running up-counting 16-bit PCA timer. The PCA timer is a common time base for all
five modules and can be programmed to run at:
1
6
the oscillator frequency,
1
2
the
oscillator frequency, the Timer 0 overflow, or the input on the ECI pin (P1[2]). The timer
count source is determined from the CPS1 and CPS0 bits in the CMOD SFR; see
Table 32 and Table 33.
In the CMOD SFR there are three additional bits associated with the PCA. They are CIDL
which allows the PCA to stop during Idle mode, WDTE which enables or disables the
watchdog function on module 4, and ECF which when set causes an interrupt and the
PCA overflow flag CF (in the CCON SFR) to be set when the PCA timer overflows.
The watchdog timer function is implemented in module 4 of PCA.
The CCON SFR contains the run control bit for the PCA (CR) and the flags for the PCA
timer (CF) and each module (CCF[4:0]). 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
Fig 19. PCA
MODULE0
PCA TIMER/COUNTER
P1[3]/CEX0
MODULE1
P1[4]/CEX1
MODULE2
P1[5]/CEX2
MODULE3
P1[6]/CEX3
MODULE4
P1[7]/CEX4
time base for PCA modules
Module functions:
- 16-bit capture
- 16-bit timer
- 16-bit high speed output
- 8-bit PWM
- watchdog timer (module 4 only)
16 bits
16 bits
002aab913
P89CV51RB2_RC2_RD2_3 © NXP B.V. 2009. All rights reserved.
Product data sheet Rev. 03 — 25 August 2009 45 of 76
NXP Semiconductors
P89CV51RB2/RC2/RD2
80C51 with 1 kB RAM, SPI
register is set. The CF bit can only be cleared by software. Bits 0 through 4 of the CCON
register are the flags for the modules (bit 0 for module 0, bit 1 for module 1, etc.) and are
set by hardware when either a match or a capture occurs. These flags can only be cleared
by software. All the modules share one interrupt vector. The PCA interrupt system is
shown in Figure 20.
Each module in the PCA has a special function register associated with it. These registers
are: CCAPM0 for module 0, CCAPM1 for module 1, etc. The registers contain the bits that
control the mode that each module will operate in.
The ECCF bit (from CCAPMn.0 where n = 0, 1, 2, 3, or 4 depending on the module)
enables the CCFn flag in the CCON SFR to generate an interrupt when a match or
compare occurs in the associated module; see Figure 20.
PWM (CCAPMn.1) enables the PWM 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.
There are two additional registers associated with each of the PCA modules. They are
CCAPnH and CCAPnL and these are the registers that store the 16-bit count when a
capture occurs or a compare should occur. When a module is used in the PWM mode,
these registers are used to control the duty cycle of the output.

P89CV51RD2FA,512

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