
EZ-USB FX2 Technical Reference Manual
Page 14-10 EZ-USB FX2 Technical Reference Manual v2.1
14.2.5 Timer 2 — 16-Bit Timer/Counter Mode
Figure 14-4 illustrates how Timer 2 operates in timer/counter mode with the optional capture fea-
ture. The C/T
2 Bit determines whether the 16-bit counter counts CLKOUT cycles (divided by 4 or
12), or high-to-low transitions on the T2 pin. The TR2 Bit enables the counter. When the count
increments from 0xFFFF, the TF2 flag is set and the T2OUT pin goes high for one CLKOUT cycle.
14.2.5.1 Timer 2 — 16-Bit Timer/Counter Mode with Capture
The Timer 2 capture mode (Figure 14-4) is the same as the 16-bit timer/counter mode, with the
addition of the capture registers and control signals.
The CP/RL
2 Bit in the T2CON SFR enables the capture feature. When CP/RL2 = 1, a high-to-low
transition on the T2EX pin when EXEN2 = 1 causes the Timer 2 value to be loaded into the cap-
ture registers RCAP2L and RCAP2H.
Figure 14-4. Timer 2 - Timer/Counter with Capture
14.2.6 Timer 2 — 16-Bit Timer/Counter Mode with Auto-Reload
When CP/RL2 = 0, Timer 2 is configured for the auto-reload mode illustrated in Figur e14-5. Con-
trol of counter input is the same as for the other 16-bit counter modes. When the count increments
from 0xFFFF, Timer 2 sets the TF2 flag and the starting value is reloaded into TL2 and TH2. Soft-
ware must preload the starting value into the RCAP2L and RCAP2H registers.
When Timer 2 is in auto-reload mode, a reload can be forced by a high-to-low transition on the
T2EX pin, if enabled by EXEN2 = 1.
0
7
Divide by 12
Divide by 4
CLKOUT
T2 pin
TR2
CLK
70
EXF2
T2M
INT
RCAP2L
TL2 TH2
RCAP2H
8
15
8
15
EXEN2
T2EX pin
CAPTURE
TF2
0
1
0
1
C/ T2
CP/RL2 = 1
Komentáře k této Příručce