English
Language : 

HMS87C1304A Datasheet, PDF (36/70 Pages) Hynix Semiconductor – CMOS SINGLE-CHIP 8-BIT MICROCONTROLLER
HMS87C1304A/HMS87C1302A
HYUNDAI MicroElectronics
12. TIMER / COUNTER
The HMS87C1304A and HMS87C1302A has two Timer/
Counter registers. Each module can generate an interrupt
to indicate that an event has occurred (i.e. timer match).
Timer 0 and Timer 1 can be used either the two 8-bit Tim-
er/Counter or one 16-bit Timer/Counter by combining
them.
In the “timer” function, the register is increased every in-
ternal clock input. Thus, one can think of it as counting in-
ternal clock input. Since a least clock consists of 2 and
most clock consists of 2048 oscillator periods, the count
rate is 1/2 to 1/2048 of the oscillator frequency in Timer0.
And Timer1 can use the same clock source too. In addition,
Timer1 has more fast clock source (1/1 to 1/8).
In the “counter” function, the register is increased in re-
sponse to a 0-to-1 (rising edge) transition at its correspond-
ing external input pin, EC0(Timer 0).
In addition the “capture” function, the register is increased
in response external interrupt same with timer function.
When external interrupt edge input, the count register is
captured into capture data register CDRx.
Timer1 is shared with “PWM” function and “Compare
output” function
It has seven operating modes: “8-bit timer/counter”, “16-
bit timer/counter”, “8-bit capture”, “16-bit capture”, “8-bit
compare output”, “16-bit compare output” and “10-bit
PWM” which are selected by bit in Timer mode register
TMx as shown in Figure 12-1 and Table 12-1 .
Timer 0 Mode Register
y TM0
-
-
CAP0 T0CK2 T0CK1 T0CK0 T0CN T0ST
ADDRESS : D0H
RESET VALUE : --000000
ar CAP0
limin T0CK[2:0]
Capture mode selection bit.
0 : Disables Capture
1 : Enables Capture
Input clock selection
000 : fxin ÷ 2, 100 : fxin ÷ 128
001 : fxin ÷ 4, 101 : fxin ÷ 512
010 : fxin ÷ 8, 110 : fxin ÷ 2048
011 : fxin ÷ 32, 111 : External Event ( EC0 )
T0CN
T0ST
Continue control bit
0 : Stop counting
1 : Start counting continuously
Start control bit
0 : Stop counting
1 : Counter start ( It must be stop before restart )
Timer 1 Mode Register
Pre TM1
POL
16BIT PWM0E CAP1 T1CK1 T1CK0 T1CN T1ST
ADDRESS : D2H
RESET VALUE : 00000000
POL
16BIT
PWM0E
CAP1
PWM Output Polarity
0 : Duty active low
1 : Duty active high
16-bit mode selection
0 : 8-bit mode
1 : 16-bit mode
PWM enable bit
0 : Disables PWM
1 : Enables PWM
Capture mode selection bit.
0 : Disables Capture
1 : Enables Capture
T1CK[2:0]
T1CN
T1ST
Input clock selection
00 : fxin
10 : fxin ÷ 8
01 : fxin ÷ 2 11 : using the Timer 0 clock
Continue control bit
0 : Stop counting
1 : Start counting continuously
Start control bit
0 : Stop counting
1 : Counter start ( It must be stop before restart )
Figure 12-1 Timer Mode Register (TM0, TM1)
36
Preliminary
Jan. 2001