Panasonic MN101C77C, F77G user manual VII 30 16-bit High Precision PWM Output

Models: F77G MN101C77C

1 544
Download 544 pages 59.61 Kb
Page 290
Image 290

Chapter 7 16-bit Timer

Setup Procedure

Description

 

 

(5) Select the count clock source.

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

TM7MD1 (x'3F78')

flag of the TM7MD1 register. Also, select 1/2

bp1-0

: TM7CK1-0 = 00

dividing as count clock source by the TM7PS1-

bp3-2

: TM7PS1-0 = 01

0 flag.

(6) Set the PWM output cycle.

(6) Set the PWM output cycle to the timer 7 preset

TM7PR1 (x'3F75',x'3F74') = x'61a7'

register 1 (TM7PR1). To be 400 Hz by divided

 

 

10 MHz, set as follows :

 

 

25000 - 1 = 24999 (x'61a7')

 

 

At that time, the same value is loaded to the

 

 

timer 7 compare register 1 (TM7OC1), and the

 

 

timer 7 binary counter (TM7BC) is initialized to

 

 

x'0000'.

(7) Set the "H" period of the PWM

(7) Set the "H" period of the PWM output to the

output.

 

timer 7 preset register 2 (TM7PR2). To be a

TM7PR2 (x'3F7D',x'3F7C')=x'186a'

1/4 duty of 25000 dividing, set as follows ;

 

 

25000 / 4 = 6250 (x'186a')

 

 

At that time, the same value is loaded to the

 

 

timer 7 compare register 2 (TM7OC2).

(8) Start the timer operation.

(8) Set the TM7EN flag of the TM7MD1 register to

TM7MD1 (x'3F78')

"1" to start timer 7.

bp4

: TM7EN = 1

 

 

 

 

 

 

 

TM7BC counts up from x'0000'. The PWM source waveform outputs "H" until TM7BC matches the set value of the TM7OC2 register. Once they matches, it outputs "L". After that, TM7BC continues to count up, once TM7BC matches the TM7OC1 register to be cleared, the PWM source waveform outputs "H" again and TM7BC counts up from x'0000' again. TM7IO pin outputs one count clock delay of the PWM source waveform.

In the initial state of the PWM output, it is changed from "L" output to "H" output as the PWM output is selected by the TM7PWM flag of the TM7MD register.

Set as the set value of TM7OC2 the set value of TM7OC1. If it is set as the set value of TM7OC2 > the set value of TM7OC1, the PWM output is a "H" fixed output.

Write to preset register should be done while timer is stopped or within timer interrupt pro- cessing.

And use MOVW instruction for write to preset register.

VII - 30 16-bit High Precision PWM Output

Page 290
Image 290
Panasonic MN101C77C, F77G user manual VII 30 16-bit High Precision PWM Output