W77IE58
Publication Release Date: October 20, 2005
- 55 - Revision A5
1/4
1/12
T0M = CKCON.3
Interrupt
C/T = TMOD.2
T0 = P3.4
TH0
TL0
TR0 = TCON.4
GATE = TMOD.3
TR1 = TCON.6
INT0 = P3.2
70
TF170
Interrupt
TF0
1
0
0
1
Clock Source
Mode input
div. by 4 osc/1
div. by 64 osc/16
div. by 1024 osc/256
Figure 13. Timer/Counter 0 Mode 3
8.1.3 Capture Mode
The capture mode is enabled by setting the CP RL/2 bit in the T2CON register to a 1, RCLK and
TCLK bits must be cleared. In the capture mode, Timer/Counter 2 serves as a 16 bit up counter.
When the counter rolls over from FFFFh to 0000h, the TF2 bit is set, which will generate an interrupt
request. If the EXEN2 bit is set, then a negative transition of T2EX pin will cause the value in the TL2
and TH2 register to be captured by the RCAP2L and RCAP2H registers. This action also causes the
EXF2 bit in T2CON to be set, which will also generate an interrupt. Setting the T2CR bit (T2MOD.3),
the W77IE58 allows hardware to reset timer 2 automatically after the value of TL2 and TH2 have been
captured.
1/4
Clock Source
Mode input
div. by 4 osc/1
div. by 64 osc/16
div. by 1024 osc/256
1/12
T2M = CKCON.5
C/T2 = T2CON.1
T2CON.7
T2 = P1.0
T2CON.6
TR2 = T2CON.2
T2EX = P1.1
EXEN2 = T2CON.3
EXF2
Timer 2
Interrupt
TF2
TH2TL2
RCAP2H
RCAP2L
1
0
0
1
Figure 14. 16-Bit Capture Mode
W77IE58
- 56 -
8.1.4 Auto-reload Mode, Counting Up
The auto-reload mode as an up counter is enabled by clearing the
CP RL/2 bit in the T2CON
register. RCLK and TCLK bits must be cleared and clearing the DCEN bit in T2MOD register. In this
mode, Timer/Counter 2 is a 16 bit up counter. When the counter rolls over from FFFFh, a reload is
generated that causes the contents of the RCAP2L and RCAP2H registers to be reloaded into the TL2
and TH2 registers. The reload action also sets the TF2 bit. If the EXEN2 bit is set, then a negative
transition of T2EX pin will also cause a reload. This action also sets the EXF2 bit in T2CON.
1/4
1/12
T2M = CKCON.5
C/T2 = T2CON.1
T2CON.7
T2 = P1.0
T2CON.6
TR2 =
T2CON.2
T2EX = P1.1
EXEN2 = T2CON.3
EXF2
Timer 2
Interrupt
TF2
TH2TL2
RCAP2HRCAP2L
1
0
0
1
Clock Source
Mode input
div. by 4 osc/1
div. by 64 osc/16
div. by 1024 osc/256
DCEN = 0
Figure 15. 16-Bit Auto-reload Mode, Counting Up
8.1.5 Auto-reload Mode, Counting Up/Down
Timer/Counter 2 will be in auto-reload mode as an up/down counter if
CP RL/2 bit in T2CON is
cleared. RCLK and TCLK bits must be cleared and the DCEN bit in T2MOD is set. In this mode,
Timer/Counter 2 is an up/down counter whose direction is controlled by the T2EX pin. A 1 on this pin
cause the counter to count up. An overflow while counting up will cause the counter to be reloaded
with the contents of the capture registers. The next down count following the case where the contents
of Timer/Counter equal the capture registers will load an FFFFh into Timer/Counter 2. In either event a
reload will set the TF2 bit. A reload will also toggle the EXF2 bit. However, the EXF2 bit can not
generate an interrupt while in this mode.
W77IE58
Publication Release Date: October 20, 2005
- 57 - Revision A5
C/T = T2CON.1
1/4
1/12
T2M = CKCON.5
Down Counting Reload Value
T2CON
.7
Up Counting Reload Value
T2 = P1.0
T2CON.6
TR2 = T2CON.2
T2EX = P1.1
EXF2
Timer 2
Interrupt
TF2
TH2TL2
RCAP2HRCAP2L
1
0
0
1
0FFh0FFh
DCEN = 1
Clock Source
Mode input
div. by 4 osc/1
div. by 64 osc/16
div. by 1024 osc/256
Figure 16. 16-Bit Auto-reload Up/Down Counter
8.1.6 Baud Rate Generator Mode
The baud rate generator mode is enabled by setting either the RCLK or TCLK bits in T2CON register.
While in the baud rate generator mode, Timer/Counter 2 is a 16 bit counter with auto reload when the
count rolls over from FFFFh. However, rolling over does not set the TF2 bit. If EXEN2 bit is set, then a
negative transition of the T2EX pin will set EXF2 bit in the T2CON register and cause an interrupt
request. T2OE bit must be cleared in this mode.
C/T = T2CON.1
T2 = P1.0
T2CON.6
TR2 = T2CON.2
T2EX = P1.1
EXEN2 = T2CON.3
EXF2
Timer 2
overflow
Timer 2
Interrupt
TH2TL2
RCAP2H
RCAP2L
0
1
Clock Source
Mode input
div. by 4 osc/2
div. by 64 osc/32
div. by 1024 osc/512
Figure 17. Baud Rate Generator Mode

W77I058A25PL

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

Products related to this Datasheet