Chapter 6 8-bit Timers

6-7-2 Setup Example

„Synchronous Output Setup Example (Timer 1, Timer 5)

Setup example that latch data of port 6 is output constantly (100 µs) by using timer 1 from the synchronous output pin is shown below. The clock source of timer 1 is selected fs/8 (at fosc=8 MHz).

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

Setup Procedure

 

 

Description

 

 

 

(1) Start the counter.

 

(1) Set the TM1EN flag of the timer 1 mode

TM1MD(x'3F55')

 

register (TM1MD) to "0" to stop the timer 1

bp3

:TM1EN

= 0

counting.

 

(2) Select the synchronous output

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

event.

 

 

register (FLOAT) to "11" to set the

FLOAT (x'3F2E')

 

synchronous output event to timer 1 interrupt.

bp1-0

:SYOEVS1-0 = 11

 

 

(3) Set the synchronous output pin.

(3) Set the port 6 synchronous output control

P6SYO (x'3F1E')

= x'FF'

register (P6SYO) to x'FF' to set the

P6DIR(x'3F36')

= x'FF'

synchronous output pin.

 

 

 

(P67 to P60 are synchronous output pin.)

 

 

 

Set the port 6 direction control register

 

 

 

(P6DIR) to x'FF' to set port 6 to output mode.

 

 

 

If it needs, pull up resistor should be added.

 

 

 

[

Chapter 4. I/O Ports ]

(4) Select the normal timer operation.

(4) Set the TM1CAS flag of the TM1MD register

TM1MD(x'3F55')

 

to "0" to select the normal timer operation.

bp4

:TM1CAS

= 0

 

 

(5) Select the count clock source.

(5) Select the prescaler output for clock source by

TM1MD(x'3F55')

 

TM1CK2-0 flag of the TM1MD register.

bp2-0

:TM1CK2-0

= 001

 

 

(6) Select the prescaler output and

(6) Select fs/8 for the prescaler output by

enable counting.

 

TM1BAS flag, TM1PSC1-0 of the timer 1

CK1MD(x'3F57')

 

prescaler selection register (CK1MD).

bp2-1

:TM1PSC1-0 = 01

Also, set the PSCEN flag of the prescaler

bp0

:TM1BAS

= 1

control register (PSCMD) to "1" to enable the

PSCMD (x'3F6F')

 

prescaler counting.

bp0

:PSCEN

= 1

 

 

 

 

 

 

 

Synchronous Output VI - 31

Page 245
Image 245
Panasonic F77G, MN101C77C user manual TM1EN, TM1CAS, TM1BAS, Pscmd x3F6F Prescaler counting Bp0