3-2 setup example – Panasonic MN101C77C User Manual

Page 308

Advertising
background image

Chapter 8 Time Base Timer / 8-bit Free-running Timer

VIII - 10

8-bit Free-running Timer

(1)

Set the TM6LRS flag of the timer 6 mode

register (TM6MD) to "0". At that time, the

initialization of the timer 6 binary counter

(TM6BC) is enabled.

(2)

Clock source can be selected by the TM6CK3-1

flag of the TM6MD register. Actually, fs is

selected.

(3)

Set the interrupt generation cycle to the timer

6 compare register (TM6OC). At that timer,

TM6BC is initialized to x'00'.

(4)

Set the TM6CLRS flag of the TM6MD register to

"1" to enable the interrupt request generation.

(5)

Set the interrupt level by the TM6LV1-0 flag of

the timer 6 interrupt control register (TM6ICR).

If the interrupt request flag may be already set,

clear them.

(6)

Set the TM6IE flag of the TM6ICR register to "1"

to enable the interrupt.

Setup Procedure

(1)

Enable the binary counter

initialization.

TM6MD (x'3F6A')

bp7

: TM6CLRS = 0

(2)

Select the clock source.

TM6MD (x'3F6A')

bp3-1

: TM6CK3-1 = 001

(3)

Set the interrupt generation cycle.

TM6OC (X'3F69')

= x'F9'

(4)

Enable the interrupt request

generation.

TM6MD (x'3F6A')

bp7

: TM6CLRS = 1

(5)

Set the interrupt level.

TM6ICR (x'3FEF')

bp7-6

: TM6LV1-0 = 01

(6)

Enable the interrupt.

TM6ICR (x'3FEF')

bp1

: TM6IE

= 1

Description

8-3-2

Setup Example

„

Timer Operation Setup (Timer 6)

Timer 6 generates an interrupt constantly for timer function. Fs(fosc = 20 MHz) is selected as a clock

source to generate an interrupt every 250 cycles (25 µs).

An example setup procedure, with a description of each step is shown below.

As TM6OC is set, TM6BC is initialized to x'00' to count up.

When TM6BC matches TM6OC, the timer 6 interrupt request flag is set to "1" at the next count

clock and TM6BC is cleared to x'00' to restart counting.

* the above steps (1), (2) can be set at once.

[

Chapter 3 3-1-4. Interrupt Flag Setup ]

Advertising
This manual is related to the following products: