P87C51RB2 PHILIPS [NXP Semiconductors], P87C51RB2 Datasheet - Page 13
![no-image](/images/no-image-200.jpg)
P87C51RB2
Manufacturer Part Number
P87C51RB2
Description
80C51 8-bit microcontroller family
Manufacturer
PHILIPS [NXP Semiconductors]
Datasheet
1.P87C51RB2.pdf
(67 pages)
Available stocks
Company
Part Number
Manufacturer
Quantity
Price
Company:
Part Number:
P87C51RB2BA
Manufacturer:
PHILIPS
Quantity:
1 155
Company:
Part Number:
P87C51RB2BA,512
Manufacturer:
NXP Semiconductors
Quantity:
10 000
Company:
Part Number:
P87C51RB2BAЈ¬512
Manufacturer:
NXP
Quantity:
3 094
Company:
Part Number:
P87C51RB2BBD
Manufacturer:
TI
Quantity:
79
Company:
Part Number:
P87C51RB2BBD
Manufacturer:
NXP
Quantity:
319
Company:
Part Number:
P87C51RB2BBD,157
Manufacturer:
NXP Semiconductors
Quantity:
10 000
Company:
Part Number:
P87C51RB2BBDЈ¬157
Manufacturer:
NXP
Quantity:
32 800
Part Number:
P87C51RB2BN
Manufacturer:
PHILIPS/飞利浦
Quantity:
20 000
two different GATE bits, one for Timer 1 (TMOD.7) and one for Timer
Philips Semiconductors
TIMER 0 AND TIMER 1 OPERATION
Timer 0 and Timer 1
The “Timer” or “Counter” function is selected by control bits C/T in
the Special Function Register TMOD. These two Timer/Counters
have four operating modes, which are selected by bit-pairs (M1, M0)
in TMOD. Modes 0, 1, and 2 are the same for both Timers/Counters.
Mode 3 is different. The four operating modes are described in the
following text.
Mode 0
Putting either Timer into Mode 0 makes it look like an 8048 Timer,
which is an 8-bit Counter with a divide-by-32 prescaler. Figure 3
shows the Mode 0 operation.
In this mode, the Timer register is configured as a 13-bit register. As
the count rolls over from all 1s to all 0s, it sets the Timer interrupt
flag TFn. The counted input is enabled to the Timer when TRn = 1
and either GATE = 0 or INTn = 1. (Setting GATE = 1 allows the
Timer to be controlled by external input INTn, to facilitate pulse width
measurements). TRn is a control bit in the Special Function Register
TCON (Figure 4).
The 13-bit register consists of all 8 bits of THn and the lower 5 bits
of TLn. The upper 3 bits of TLn are indeterminate and should be
ignored. Setting the run flag (TRn) does not clear the registers.
Mode 0 operation is the same for Timer 0 as for Timer 1. There are
0 (TMOD.3).
2003 Jan 24
80C51 8-bit microcontroller family
with 512B/1KB RAM, low voltage (2.7 to 5.5 V), low power, high
speed (30/33 MHz)
TMOD
BIT
TMOD.3/
TMOD.7
TMOD.2/
TMOD.6
Address = 89H
Not Bit Addressable
SYMBOL
GATE
C/T
M1
0
0
1
1
1
M0
0
1
0
1
1
FUNCTION
Gating control when set. Timer/Counter “n” is enabled only while “INTn” pin is high and
“TRn” control pin is set. when cleared Timer “n” is enabled whenever “TRn” control bit is set.
Timer or Counter Selector cleared for Timer operation (input from internal system clock.)
Set for Counter operation (input from “Tn” input pin).
OPERATING
8048 Timer: “TLn” serves as 5-bit prescaler.
16-bit Timer/Counter: “THn” and “TLn” are cascaded; there is no prescaler.
8-bit auto-reload Timer/Counter: “THn” holds a value which is to be reloaded
into “TLn” each time it overflows.
(Timer 0) TL0 is an 8-bit Timer/Counter controlled by the standard Timer 0 control bits.
TH0 is an 8-bit timer only controlled by Timer 1 control bits.
(Timer 1) Timer/Counter 1 stopped.
Figure 2. Timer/Counter 0/1 Mode Control (TMOD) Register
GATE
7
8KB/16KB/32KB/64KB OTP
C/T
6
TIMER 1
M1
5
M0
4
13
GATE
Mode 1
Mode 1 is the same as Mode 0, except that the Timer register is
being run with all 16 bits.
Mode 2
Mode 2 configures the Timer register as an 8-bit Counter (TLn) with
automatic reload, as shown in Figure 5. Overflow from TLn not only
sets TFn, but also reloads TLn with the contents of THn, which is
preset by software. The reload leaves THn unchanged.
Mode 2 operation is the same for Timer 0 as for Timer 1.
Mode 3
Timer 1 in Mode 3 simply holds its count. The effect is the same as
setting TR1 = 0.
Timer 0 in Mode 3 establishes TL0 and TH0 as two separate
counters. The logic for Mode 3 on Timer 0 is shown in Figure 6. TL0
uses the Timer 0 control bits: C/T, GATE, TR0, and TF0 as well as
pin INT0. TH0 is locked into a timer function (counting machine
cycles) and takes over the use of TR1 and TF1 from Timer 1. Thus,
TH0 now controls the “Timer 1” interrupt.
Mode 3 is provided for applications requiring an extra 8-bit timer on
the counter. With Timer 0 in Mode 3, an 80C51 can look like it has
three Timer/Counters. When Timer 0 is in Mode 3, Timer 1 can be
turned on and off by switching it out of and into its own Mode 3, or
can still be used by the serial port as a baud rate generator, or in
fact, in any application not requiring an interrupt.
3
C/T
2
TIMER 0
P87C51RA2/RB2/RC2/RD2
M1
1
M0
0
Reset Value = 00H
SU01580
Product data