8-2 setup example – Panasonic MN101C77C User Manual

Page 292

Advertising
background image

Chapter 7 16-bit Timer

VII - 32

16-bit Timer Synchronous Output

7-8-2

Setup Example

„

Synchronous Output Setup Example (Timer 7)

Setup example that latched data of port 6 is output constantly (100 µs) by using timer 7 from the synchro-
nous output pin is shown below. The clock source of timer 7 is selected fs/4 (at fosc=8 MHz).
An example setup procedure, with a description of each step is shown below.

(1) Set the TM7EN flag of the timer 7 mode

register 1 (TM7MD1) to "0" to stop timer 7
counting.

(2) Set the SYOEVS1-0 flag of the pin control

register (FLOAT) to "01" to set the
synchronous output event to the timer 7
interrupt.

(3) Set the port 6 synchronous output control

register (P6SYO) to x'FF' to set the
synchronous output pin.

(P67 to P60 : Synchronous output pin)

Set the port 6 direction control register
(P6DIR) to x'FF' to set port 6 to output pin.
If it needs, pull-up resistor should be added.

(4) Set the TM7BCR flag of the TM7MD2 register

to "1" to select the compare match as a clear
source of the binary counter.

(5) Select fs as a clock source by the TM7CK1-0

flag of the TM7MD 1 register.
Also, select a 1/4 dividing as a clock source by
the TM7PS1-0 flag.

(6) Set the synchronous output event generation

cycle to the timer 7 preset register 1
(TM7PR1). To be 10 kHz by dividing 1 MHz,
set as follows ;

100 - 1 = 99 (x'0063')

At that time, the same value is loaded to the
timer 7 compare register 1 (TM7OC1), and
TM7BC is initialized to x'0000'.

Setup Procedure

(1) Stop the counter.

TM7MD1 (x'3F78')

bp4

: TM7EN

= 0

(2) Select the synchronous output

event.

FLOAT (x'3F2E')

bp1-0

: SYOEVS1-0 = 01

(3) Set the synchronous output pin.

P6SYO (x'3F1E')

= x'FF'

P6DIR (x'3F36')

= x'FF'

(4) Select the condition of timer clear.

TM7MD2 (x'3F79')

bp5

: TM7BCR = 1

(5) Select the count clock source.

TM7MD1 (x'3F78')

bp1-0

: TM7CK1-0 = 01

bp3-2

: TM7PS1-0 = 10

(6) Set the synchronous output event

generation cycle.
TM7PR1 (x'3F75',x'3F74')=x'0063'

Description

[

Chapter 4 I/O Ports ]

Advertising
This manual is related to the following products: