English
Language : 

GMS30C2116 Datasheet, PDF (121/322 Pages) Hynix Semiconductor – USERS MANUAL
TIMER
5-1
5. Timer
5.1 Overview
The on-chip timer is controlled via three registers:
Timer prescaler register TPR G21
Timer register TR
G23
Timer compare register TCR
G22
G21..G23 can be addressed only via the high global flag H by a MOV or MOVI instruction.
The content of G21 (timer prescaler register) cannot be read.
The write-only TPR sets a carry flag C (overflow) when the value of the counter in TPR
equals to the content of TPR, and transfers carry flag C to the TR. When the TPR transfers
carry flag to the TR, TR increments by one on modulo 232. Timer clock frequency is
determined by the content of TPR.
When the TR is higher than or equals to the TCR, the timer interrupt is generated.
Processor Clock
Frequency
carry
TPR
TR
Timer Clock
Frequency
compare x
Timer Interrupt
TCR
Fig. 5.1 The block diagram of on-chip timer.
5.1.1 Timer Prescaler Register TPR
The write-only TPR adapts the timer clock to different processor clock frequencies. Only
bit positions 23..16 are used, all other bits are reserved and must be zero on a move to the
TPR.
The TPR operates from the processor clock input CLKIN and divides the processor clock
according to:
frequency of timer clock := frequency of processor clock divided by (n+2)
n is the value to be loaded into the TPR at the bit positions 23..16, it is calculated according
to the formula:
n = (time unit ∗ frequency of processor clock) - 2
time unit is the basic time interval for the timer operation (time unit := 1 / frequency of timer
clock). n must be in the range of 2..255.