beautypg.com

Chapter 7 timer/counter units – NEC PD78214 User Manual

Page 164

background image

135

Chapter 7 Timer/Counter Units

7

(4) PWM output operation

In PWM output operation, a pulse signal with a duty factor determined by the value set in a compare register
is output. (See Fig. 7-35.)

The duty factor of a PWM output signal can be changed in steps of 1/65536 from 1/65536 to 65535/65536.

In addition, 16-bit timer 0 (TM0) has two compare registers, so that two types of PWM signals can be output.

Fig. 7-36 shows the setting of control registers. Fig. 7-37 shows the setting procedure. Fig. 7-38 shows the
procedure for changing the duty factor of PWM output.

Fig. 7-35 Example of PWM Signal Output by 16-Bit Timer/Counter

FFFFH

FFFFH

FFFFH

CR00

CR00

CR00

Timer starts

0H

TM0
count value

(active low)

TO0

Fig. 7-36 Setting of Control Registers for PWM Output Operation

(a) Timer control register 0 (TMC0)

(b) Capture/compare control register 0 (CRC0)

7

6

5

4

3

2

1

0

1

0

0

0

0

0

0

1

CRC0

Disables clearing TM0

Both TO0 and TO1 are used for
PWM output

(c) Timer output control register (TOC)

(d) Port 3 mode control register (PMC3)

7

6

5

4

3

2

1

0

TOC

1

1

Ч

Ч

Ч

Ч

Ч

Ч

TO0 for low-active PWM signal output

Enables PWM output for TO0

7

6

5

4

3

2

1

0

Ч

Ч

Ч

Ч

Ч

Ч

Ч

1

PMC3

Specifies P34 pin as TO0
output

7

6

5

4

3

2

1

0

0

0

0

0

0

0

1

TMC0

Overflow flag

Enables counting TM0

Ч

This manual is related to the following products: