Setup Example - Panasonic MN101L Series User Manual

Lsi
Table of Contents

Advertisement

10.3.2

Setup Example

Timer Operation Setup (Timer 6)
The timer 6 generates interrupts regularly for the clock function. Interrupts are generated every 250 dividing (62.5
µs) when selecting SYSCLK (at f
The setup procedure and the description of each step are shown below.
Setup Procedure
(1) Enable the binary counter initialization
TM6MD (0x03F7A)
bp7: TM6CLRS = 0
(2) Disable the interrupt
PERI0EN (0x03FDC)
bp1: PERI0EN1 = 0
(3) Select the clock source
TM6MD (0x03F7A)
bp3-1: TM6CK3-1 = 001
(4) Set the interrupt generation cycle
TM6OC (0x03F79) = 0xF9
(5) Enable the interrupt request generation
TM6MD (0x03F7A)
bp7: TM6CLRS = 1
(6) Set the interrupt level
PERI0ICR (0x03FFD)
bp7-6: PERI0LV1-0 = 01
(7) Enable the interrupt
PERI0EN (0x03FDC)
bp1: PERI0EN1 = 1
(8) Start the TM6 operation
TM6BEN (0x03F7C)
bp0: TM6EN = 1
When TM6OC is set, TM6BC is initialized to 0x00.
When TM6BC value matches the value specified in TM6OC, the timer 6 interrupt request is set at the next count
clock and TM6BC is cleared to 0x00 to restart counting.
= 4 MHz) as a clock source.
SYSCLK
(1) Set the TM6CLRS bit of the timer 6 mode register
(TM6MD) to "0" to enable the initialization of the timer
6 binary counter (TM6BC).
(2) Set the PERI0EN1 bit of the PERI0EN register to "0" to
disable the interrupt.
(3) Set the TM6CK3-1 bits of the TM6MD register to select
the clock source. In this case, SYSCLK is selected.
(4) Set the interrupt generation cycle to the timer 6 compare
register (TM6OC). At this time, TM6BC is initialized to
0x00.
(5) Set the TM6CLRS bit of the TM6MD register to "1" to
enable the interrupt request generation.
(6) Set the PERI0LV1-0 bits of the peripheral function group
0 interrupt level control register (PERI0ICR) to select
the interrupt level. Clear the corresponding interrupt
request bit of PERI0DT register, if it may have already
been set.
[3.1.5 Set up procedure for Interrupt control register for
peripheral function group]
(7) Set the PERI0EN1 bit of the PERI0EN register to "1" to
enable the interrupt.
(8) Set the TM6EN bit of the TM6BEN register to "1" to start
the timer 6.
General-Purpose Time Base/Free-Running Timer
Description
8-bit Free-running Timer
Chapter 10
X - 11

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mn101lr05dMn101lr04dMn101lr03dMn101lr02d

Table of Contents