89C5121-SK1 Atmel, 89C5121-SK1 Datasheet - Page 74

no-image

89C5121-SK1

Manufacturer Part Number
89C5121-SK1
Description
KIT SMART CARD FOR AT89C5121
Manufacturer
Atmel
Type
Smart Cardr
Datasheet

Specifications of 89C5121-SK1

Contents
Board
For Use With/related Products
AT89C5121
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
Other names
T89C5121-SK1
T89C5121-SK1
Timer 0
Mode 0 (13-bit Timer 0)
Figure 28. Timer 0/Counter x (x = 0 or 1) in Mode 0
Mode 1 (16-bit Timer 0)
74
INTx#
A/T8xC5121
Tx
FCLK_Periph
TMOD reg
GATEx
TMOD reg
C/Tx#
Timer 0 functions as either a Timer 0 or an event Counter in four operating modes.
Figure 28 through Figure 31 show the logic configuration of each mode.
Timer 0 is controlled by the four lower bits of the TMOD register (see Figure 56) and bits
0, 1, 4 and 5 of the TCON register (see Figure 55). The TMOD register selects the
method of Timer 0 gating (GATE0), Timer 0 or Counter operation (T/C0#) and the oper-
ating mode (M10 and M00). The TCON register provides Timer 0 control functions:
overflow flag (TF0), run control bit (TR0), interrupt flag (IE0) and interrupt type control bit
(IT0).
For normal Timer 0 operation (GATE0 = 0), setting TR0 allows TL0 to be incremented
by the selected input. Setting GATE0 and TR0 allows external pin
operation.
Timer 0 overflow (count rolls over from all 1s to all 0s) sets the TF0 flag and generates
an interrupt request.
It is important to stop the Timer 0/Counter before changing modes.
Mode 0 configures Timer 0 as a 13-bit Timer 0 which is set up as an 8-bit Timer 0 (TH0
register) with a module-32 prescaler implemented with the lower five bits of the TL0 reg-
ister (see Figure 28). The upper three bits of the TL0 register are indeterminate and
should be ignored. Prescaler overflow increments the TH0 register.
Mode 1 configures Timer 0 as a 16-bit Timer 0 with the TH0 and TL0 registers con-
nected in a cascade (see Figure 29). The selected input increments the TL0 register.
0
1
TCON reg
TRx
(8 bits)
THx
(5 bits)
TLx
Overflow
TCON reg
TFx
INT0
to control Timer 0
Timer 0 x
Interrupt
Request
4164G–SCR–07/06

Related parts for 89C5121-SK1