EasyManua.ls Logo

Panasonic MN103S

Panasonic MN103S
552 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 8
8-bit Timer
Interval Timer VIII - 35
8.4.2 Setup Example
Interval Timer Setup Example
Timer function can be set by using timer 0 that generates the constant interrupts. Interrupts are generated every
150 dividing (5µs) by selecting the clock source IOCLK. The oscillator frequency is set to 10 MHz, 6 multiplica-
tion and IOCLK=MCLK/2.
A setup procedure with a description of each step is shown below:
TM0BC counter starts to count down. When the TM0BC counter generates underflow, the interrupt request flag is
set. The value of the TM0BR register is loaded into the value of the TM0BC counter, and the counting down oper-
ation restarts.
Setup Procedure Description
(1) Stop the counter
TM0MD(0x0000A180)
bp6: TM0LDE=0
bp7: TM0CNE=0
(1) Set the TM0LDE flag and TM0CNE flag of timer 0
mode register (TM0MD) to “0” to stop counting of timer
0.
(2) Disable an interrupt
G3ICR(0x0000890C)
bp8: G3IE0=0
(2) Set the G3IEO flag of the G3ICR register to “0” to
disable an interrupt.
(3) Set the interrupt generation cycle
TM0BR(0x0000A188)=0x95
(3) Set the interrupt generation cycle to timer 0 base
register (TM0BR). The set value is 149 (0x95) due to
150 dividing.
(4) Select the count clock source
TM0MD(0x0000A180)
bp2-0: TM0CK2-0=000
(4) Select the count clock source (IOCLK) by the TM0CK2
to 0 flag of the TM0MD register.
(5) Initialize timer 0
TM0MD(0x0000A180)
bp6: TM0LDE=1
(5) Set the TM0LDE flag of the TM0MD register to “1” to
initialize timer 0. The value of the TM0BR register is
loaded into the TM0BC counter. Reset the TM0LDE
flag to “0” after setting.
(6) Set an interrupt level
G3ICR(0x0000890C)
bp14-12: G3LV2-0=100
(6) Set an interrupt level by the G3LV2 to 0 flag of the
G3ICR register. Clear the request flag if the interrupt
request flag is already set.
(7) Enable an interrupt
G3ICR(0x0000890C)
bp8: G3IE0=1
(7) Set the G3IEO flag of the G3ICR register to “1” to enable
an interrupt.
(8) Start timer operation
TM0MD(0x0000A180)
bp7: TM0CNE=1
(8) Set the TM0CNE flag of the TM0MD register to “1” to
operate timer 0.

Table of Contents

Other manuals for Panasonic MN103S

Related product manuals