English
Language : 

GMS82524 Datasheet, PDF (40/93 Pages) Hynix Semiconductor – 8-BIT SINGLE-CHIP MICROCONTROLLERS
HYUNDAI MicroElectronics
GMS82512/16/24
8-bit Timer Mode
In the timer mode, the internal clock is used for counting
up. Thus, you can think of it as counting internal clock in-
put. The contents of TDRn are compared with the contents
of up-counter, Tn. If match is found, a timer 1 interrupt
(T1IF) is generated and the up-counter is cleared to 0.
Counting up is resumed after the up-counter is cleared.
As the value of TDRn is changeable by software, time in-
terval is set as you want
Value of Clock
TM[1:0] Source
00
fEC1
01
fXIN ÷ 4
10
fXIN ÷ 16
11
fXIN ÷ 64
Resolution
(At fXIN=8 M H z)
1/fEC1 sec
0.5 us
2 us
8 us
Maximum Time
Setting
(At fXIN=8 M H z)
1/fEC1 × 256 sec
128 us
512 us
2048 us
Table 11-1 Timer Source clock Interrupt Time
Source clock
Start count
Up-counter
0
TDR1
T1IF interrupt
1
2
3
n
n-2 n-1 n 0 1
2
3
4
Match Counter
Detect Clear
Figure 11-4 Timer Mode Timing Chart
Example: Make 1msinterrupt using by Timer0 at 8MHz
LDM
LDM
SET1
EI
TM0,#1FH
TDR0,#125
T0E
; divide by 64
; 8us x 125= 1ms
; Enable Timer 0 Interrupt
; Enable Master Interrupt
When TM0 = 0001 1111B (8-bit Timer mode, Prescaler divide ratio = 64)
TDR0 = 125D = 7DH
fXIN = 8 MHz
INTERRUPT PERIOD =
1
8 × 106 Hz
× 64 × 125 = 1 ms
TDR1
7D
MATCH
(TDR0 = T0)
7D
7C
Count Pulse
Period
7B
~~
~~
up-count
7A
~~
8 µs
6
5
4
3
2
1
0
0
Timer 1 (T1IF)
Interrupt
Interrupt period
= 8 µs x 125
Occur interrupt
Occur interrupt
Occur interrupt
Figure 11-5 Timer Count Example
TIME
FEB. 2000 Ver 1.00
37