Setup Example - Panasonic MN101L Series User Manual

Lsi
Table of Contents

Advertisement

8.3.2

Setup Example

Timer Operation Setup Example (Timer 0 to Timer 5)
Here is an example that the periodic interrupt of Timer 0 is generated to execute the timer function. An interrupt is
generated every 250 cycles (200 µs) by selecting SYSCLK/2 (at f
The setup procedure and the description of each step are shown below.
Step
Setting
1
Disable the timer counter
2
Disable the interrupt
Set the timer mode register
3
4
Set the prescaler
5
Set the interrupt cycle
6
7
Set the interrupt level
8
Enable the interrupt
9
Enable the timer counter
Symbol
TM0MD.TM0EN = 0
Disable the timer count operation.
TM0ICR.TM0IE = 0
Disable the timer interrupt.
TM0MD.TM0PWM = 0
Select the normal timer operation.
TM0MD.TM0MOD = 0
TM0MD.TM0CK1-0 = 01
Select the clock source.
CK0MD.TM0PSC1-0 = X0
Select SYSCLK/2.
CK0MD.TM0BAS = 1
TM0OC = 0xF9
Set the cycle of timer interrupt.
Setup value: 249 (0xF9)
TM0ICR.TM0LV1-0
Refer to [3.1.3 Maskable Interrupt Control Register Setup].
TM0ICR.TM0IE = 1
TM0MD.TM0EN = 1
Enable the timer count operation.
= 2.5 MHz operation) as a clock source.
sysclk
Description
Chapter 8
8-bit Timer
8-bit Timer
VIII - 19

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mn101lr05dMn101lr04dMn101lr03dMn101lr02d

Table of Contents