Chapter 9
16-bit Timer
IX - 24 16-bit Timer
9.3.2 Setup Example
Timer Operation Setup Example
Here is an example that the periodic interrupt of Timer 7 is generated every 1000 cycles (250 µs) with selecting
HCLK/2 (at f
HCLK
= 8 MHz) as a clock source. The setup procedure and its description are shown below.
Step Setting Register Description
1 Disable the timer counter TM7MD1.TM7EN = 0 Disable the timer count operation.
2 Disable the interrupt TM7ICR.TM7IE = 0 Disable the timer interrupt.
3 Set the timer mode register TM7MD2.TM7BCR = 1 Select the TM7BC clear source.
4
TM7MD1.TM7CK1-0 = 00
TM7MD1.TM7PS1-0 = 01
Select the clock source.
5
Set the interrupt cycle TM7PR1 = 0x03E7 Set the cycle of timer interrupt.
Setup value: 1000 - 1 = 999 (0x03E7)
6 Set the interrupt level TM7ICR.TM7LV1-0 Refer to [3.1.3 Maskable Interrupt Control Register Setup].
7 Enable the interrupt TM7ICR.TM7IE = 1
8 Enable the timer counter TM7MD1.TM7EN = 1 Enable the timer count operation.