11 16-bit timer setup examples, 1 setting up an event counter using timer 4, Timers – Lucent Technologies MN10285K User Manual

Page 95

Advertising
background image

Timers

16-Bit Timer Setup Examples

Panasonic Semiconductor Development Company

MN102H75K/F75K/85K/F85K LSI User Manual

94

Panasonic

4.11 16-Bit Timer Setup Examples

4.11.1 Setting Up an Event Counter Using Timer 4

In this example, timer 4 counts the TM4IB input signal (B

OSC

/4 = 6 MHz or less)

and generates an interrupt on the second and fifth cycles.

To set up timer 4:

Use the MOV instruction for this

setup and only use 16-bit write
operations.

This step stops the TM4BC

count and clears both TM4BC

and the S-R flip-flop to 0.

1.

Set the operating mode in the timer 4 mode register (TM4MD). Disable

timer 4 counting and interrupts. Select up counting. Select TM4IB as the
clock source.

TM4MD (example)

x’00FE80’

2.

Set the divide-by ratio for timer 4. To divide the TM4IB input signal by 5,
write x’0004’ to timer 4 compare/capture register A (TM4CA). (The valid

range for TM4CA is x’0001’ to x’FFFE’.)

A. Chip Level

B. Block Level

Figure 4-27 Block Diagram of Event Counter Using Timer 4

TM4IB

P2

P6

P4

P5

CORE

Interrupts

Timers 0-3

Timers 4-5

ROM, RAM

Bus Controller

Serial I/Fs

ADC

(B

OSC

/4)

up

TM4BC

Timer 4

TM4CA

TM4CAX

TM4CB

TM4CBX

TM4IB

(TM4OA)

T

Q

T

Q

R
S

Q

Controller

Bit:

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

TM4

EN

TM4
NLD

TM4
UD1

TM4
UD0

TM4
TGE

TM4
ONE

TM4
MD1

TM4

MD0

TM4

ECLR

TM4

LP

TM4

ASEL

TM4

S2

TM4

S1

TM4

S0

Setting:

0

0

0

0

0

0

0

0

0

0

0

1

0

0

1

0

Advertising
This manual is related to the following products: