Panasonic F77G, MN101C77C user manual P1OMD4, Also, set the T7PWMSL flag to 1 to select

Models: F77G MN101C77C

1 544
Download 544 pages 59.61 Kb
Page 289
Image 289

Chapter 7 16-bit Timer

7-7-2 Setup Example

„High Precision PWM Output Setup Example (Timer 7)

The TM7IO output pin outputs the 1/4 duty PWM output waveform at 400 Hz with timer 7. Select fosc/2 (at fosc = 20 MHz) as a clock source. One cycle of the PWM output waveform is decided by the set value of a compare register 1. "H" period of the PWM output waveform is decided by the set value of a compare register 2.

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

TM7IO output

400 Hz

Figure 7-7-4 Output Waveform of TM7IO Output Pin

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 the P14 pin as a

P1OMD (x'3F2F')

 

 

special function pin. Set the P1DIR4 flag of the

bp4

:P1OMD4

= 1

 

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

P4DIR (x'3F31')

 

 

for output mode.

bp4

: P1DIR4

= 1

 

Add pull-up resistor, if it necessary.

 

 

 

[

Chapter 4 I/O Ports ]

(3) Set the PWM output.

 

(3)

Set the TM7PWM flag of the timer 7 mode

TM7MD2 (x'3F79')

 

 

register 2 (TM7MD2) to "1" to select the PWM

bp4

: TM7PWM = 1

 

output.

(4) Set the high precision PWM output

(4)

Set the TM7BCR flag of the TM7MD2 register

operation.

 

 

 

to "1" to select the TM7OC1 compare match

TM7MD2 (x'3F79')

 

 

as a clear source of binary counter.

bp5

: TM7BCR

= 1

 

Also, set the T7PWMSL flag to "1" to select the

bp6

: T7PWMSL = 1

 

TM7OC2 compare match as a duty decision

 

 

 

 

source of the PWM output.

 

 

 

 

 

16-bit High Precision PWM Output VII - 29

Page 289
Image 289
Panasonic F77G, MN101C77C user manual P1OMD4, Also, set the T7PWMSL flag to 1 to select