English
Language : 

GMS81C7216 Datasheet, PDF (51/121 Pages) List of Unclassifed Manufacturers – 8-BIT SINGLE-CHIP MICROCONTROLLERS
GMS81C7208/7216
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 input. The
contents of TDRn (n=0,1,2,3) are compared with the contents of
up-counter, Tn (n=0,1,2,3). If match is found, a timer 1 interrupt
Source clock
Start count
Up-counter
0
TDR1
T1IF interrupt
1
2
3
n
(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 can be re-written by software, time interval
is set as you want.
n-2 n-1 n 0 1
2
Counter
Clear
Match
Detect
3
4
Figure 13-5 Timer Mode Timing Chart
Example: Make 1ms interrupt using by Timer0 at 4MHz
LDM
LDM
SET1
EI
TM0,#0FH
TDR0,#124
T0E
; divide by 32
; 8us x (124+1)= 1ms
; Enable Timer 0 Interrupt
; Enable Master Interrupt
When
TM0 = 0000_1111B (8-bit Timer mode, Prescaler divide ratio → ÷32)
TDR0 = 124D = 7CH
fXIN = 4 MHz
INTERRUPT PERIOD =
1
4 × 106 Hz
× 32 × (124+1) = 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 13-6 Timer Count Example
TIME
FEB. 2005 Ver 1.04
47