![](http://datasheet.mmic.net.cn/110000/ML674001TC_datasheet_3507949/ML674001TC_250.png)
ML674001 Series/ML675001 Series User’s Manual
Chapter 15
Timers
15-13
15.3
Description of Operation
15.3.1
System Timer
1.
Reload timer operation
The System Timer operates independently from the six Auto Reload Timers.
The three registers that
control this timer are outlined in the Register List table on page 15-3.
The System Timer is organized around a 16-bit counter.
The input time-base to the System Timer
block is the CCLK.
The CCLK input is divided by a factor of 16 and this forms the time-base for the
counter. Once enabled by writing a “1” to the Timer Enable Register (TMEN), the counter counts up
each cycle of the ‘CCLK/16’ input-signal starting from the initial value programmed in to the Timer
Counter Register (TMC).
Note that when the user program sets the Timer Reload Register
(TMRLR), the hardware simultaneously copies the contents of TMRLR to the Timer Counter (TMC)
register.
The user program does not have direct access to the TMC register.
The value of the counter is incremented at each cycle of the clock.
When the counter has reached the
value of 0xFFFF, an overflow occurs and bit OVF of the System Timer Overflow Register
(TMOVFR) is set to ‘1’, thus asserting an interrupt request signal.
In the next processor clock cycle,
the timer counter is reloaded with the program specified value from TMRLR register, and continues
counting up.
The interval of the System Timer Overflow is defined as follows:
Interval[
SEC] = 16 × (65536 TMRLR[15:0]) / CCLK[MHz]
The time-base for System Timer is CCLK and as noted in Chapter 7, CCLK can be divided by setting
the Clock Gear Control Register (CGBCNT0) as necessary.
The user should note that changing
CGBCNT0 register will affect the operation of other peripherals in this LSI.
To avoid timing conflicts in the System Timer block, the program must leave the following interval
between successive writes to TMRLR register.
n
× HCLK + 79 × CCLK
The System Timer operation can be stopped at anytime by writing a “0” to the System Timer Enable
Register (TMEN).
2.
Timer overflow interrupt
Timer counter overflow triggers an interrupt request and sets the OVF bit in the counter overflow
register (TMOVFR) to “1.”
Writing “1” to TMOVFR clears the interrupt request.