GMS82512/16/24
HYUNDAI MicroElectronics
8-bit Event Counter Mode
In order to use event counter function, the bit 4 of the Port
Mode Register PMR4(address 0D0H) is required to be set
to “1”.
In this mode, counting up is started by an external trigger.
This trigger means falling edge of the EC0 pin input.
Source clock is used as an internal clock selected with tim-
er mode register TM0. The contents of timer data register
TDRn (n = 0,1) are compared with the contents of the up-
counter Tn. If a match is found, an timer interrupt request
flag TnIF is generated, and the counter is cleared to “0”.
The counter is restart and count up continuously by every
falling edge of the EC0 pin input.
After reset, the value of timer data register TDRn is unde-
fined, it should be initialized to between 1H~FFHꢃꢁnot to
"0"The interval period of Timer is calculated as below
equation.
1
----------
Period (sec) =
× 2 × Divide Ratio × TDRn
f
XIN
The maximum frequency applied to the EC0 pin is fXIN/2
[Hz].
Start count
EC0 pin input
1
1
2
Up-counter
0
2
n-1
n
0
TDR1
n
T1IF interrupt
Figure 11-6 Event Counter Mode Timing Chart
TDR1
enable
disable
clear & start
stop
TIME
Timer 1 (T1IF)
Interrupt
Occur interrupt
Occur interrupt
T1ST
Start & Stop
T1ST = 1
T1ST = 0
T1CN
T1CN = 1
Control count
T1CN = 0
Figure 11-7 Count Operation of Timer / Event counter
38
FEB. 2000 Ver 1.00