
SINGLE-CHIP 8-BIT CMOS MICROCOMPUTER
MITSUBISHI MICROCOMPUTERS
7560 Group
38
PULSE WIDTH MODULATION (PWM)
The 7560 group has a PWM function with an 8-bit resolution,
using f(X
IN
) or f(X
IN
)/2 as a count source.
Data Setting
The PWM output pins are shared with ports P5
0
and P5
1
. Set the
PWM period by the PWM prescaler, and set the period during
which the output pulse is an
“
H
”
by the PWM register.
If PWM count source is f(X
IN
) and the value in the PWM prescaler
is n and the value in the PWM register is m (where n = 0 to 255
and m = 0 to 255) :
PWM period = 255
(n+1)/f(X
IN
)
= 31.875
(n+1)
μ
s (when f(X
IN
) = 8 MHz)
Output pulse
“
H
”
period = PWM period
m/255
= 0.125
(n+1)
m
μ
s
(when f(X
IN
) = 8 MHz)
PWM Operation
When either bit 1 (PWM
0
function enable bit) or bit 2 (PWM
1
func-
tion enable bit) of the PWM control register or both bits are
enabled, operation starts from initializing status, and pulses are
output starting at
“
H
”
. When one PWM output is enabled and that
the other PWM output is enabled, PWM output which is enabled to
output later starts pulse output from halfway of PWM period (see
Figure 39).
When the PWM register or PWM prescaler is updated during
PWM output, the pulses will change in the cycle after the one in
which the change was made.
Fig. 36 Timing of PWM cycle
Fig. 37 Block diagram of PWM function
31.875
m
(n+1)
255
μ
s
T = [31.875
(n+1)]
μ
s
PWM output
m: Contents of PWM register
n : Contents of PWM prescaler
T : PWM cycle (when f(X
IN
) = 8 MHz)
D
a
t
a
b
u
s
Count source
selection bit
”
“
0
“
1
”
P
a
W
e
r
M
p
e
p
r
e
s
c
l
r
-
l
a
t
c
h
P
t
e
W
r
M
p
r
r
e
g
i
s
e
-
l
a
t
c
h
PWM
prescaler latch
P
i
s
W
t
e
M
r
a
r
e
g
l
t
c
h
Transfer control circuit
PWM circuit
1
/
2
X
I
N
P
W
e
M
0
n
a
f
u
l
e
n
c
b
t
i
i
t
o
n
b
P
5
1
/
P
W
M
1
P
W
M
p
r
e
s
c
a
l
e
r
PWM
1
function
enable bit
P
l
a
o
r
t
t
h
P
5
1
c
P
l
a
o
r
t
t
h
P
5
0
c
P
5
0
/
P
W
M
0