Panasonic F77G, MN101C77C user manual TM7PWM, Pulse output, Source of a binary counter

Models: F77G MN101C77C

1 544
Download 544 pages 59.61 Kb
Page 281
Image 281

Chapter 7 16-bit Timer

7-5-2 Setup Example

„Timer Pulse Output Setup Example (Timer 7)

TM7IO pin outputs 50 kHz pulse by using timer 7. For this, select fosc as clock source, and set a 1/2 cycle (100 kHz) for the timer 7 compare register (at fosc=20 MHz).

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

 

Setup Procedure

 

 

 

Description

 

 

 

 

 

(1)

Stop the counter.

 

(1)

Set the TM7EN flag of the timer 7 mode

 

TM7MD1 (x'3F78')

 

 

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

 

bp4

: TM7EN

= 0

 

counting.

(2)

Set the special function pin to output

(2)

Set the P1OMD4 flag of the port 1 output mode

 

mode.

 

 

 

register (P1OMD) to "1" to set P14 pin as the

 

P1OMD (x'3F2F')

 

 

special function pin. Set the P1DIR4 flag of the

 

bp4

: P1OMD4

= 1

 

port 1 direction control register (P1DIR) to "1"

 

P1DIR (x'3F31')

 

 

to set output mode.

 

bp4

: P1DIR4

= 1

 

If it needs, pull-up resistor should be added.

 

 

 

 

 

[

Chapter 4 I/O Ports ]

(3)

Set the timer pulse output.

 

(3)

Set the TM7PWM flag of the timer 7 mode

 

TM7MD2 (x'3F79')

 

 

register 2 (TM7MD2) to "0" to select the timer

 

bp4

: TM7PWM

= 0

 

pulse output.

(4)

Select the condition for timer clear.

(4)

Set the TM7BCR flag of the TM7MD2 register

 

TM7MD2 (x'3F79')

 

 

to "1" to select the compare match as a clear

 

bp5

: TM7BCR

= 1

 

source of a binary counter .

(5)

Select the count clock source.

(5)

Select fosc as an clock source by the

 

TM7MD1 (x'3F78')

 

 

TM7CK1-0 flag of the TM7MD1 register.

 

bp1-0

: TM7CK1-0 = 00

 

Also, select 1/1 frequency as an count clock

 

bp3-2

: TM7PS1-0 = 00

 

source by the TM7PS1-0 flag.

 

 

 

 

 

 

 

16-bit Timer Pulse Output VII - 21

Page 281
Image 281
Panasonic F77G, MN101C77C user manual TM7PWM, Pulse output, Source of a binary counter