BAT32G1x9 user manual | Chapter 10 Timer M
384 / 1149
Rev.1.02
10.5.3
PWM function
This is the function of the output PWM waveform. Up to 3 PWM waveforms of the same period can be output
via the timer Mi (i=0, 1). By synchronizing timer M0 with timer M1, up to six PWM waveforms of the same period can
be output.
Because the TMIOji pins (j=B, C, D) and the TMGRji registers are used in combination, they can be selected by pin
for the PWM function. or other modes and functions (however, the TMGRAi register is used regardless of which pin
is used as the PWM function, so the TMGRAi register cannot be used for other modes).
The block diagram and specifications of the PWM function are shown in Figures 10-53 and Table 10-14,
respectively, and the operating examples of the PWM functions are shown in Figures 10-54 and 10-55.
Figure 10-53 Block diagram of the PWM function
0
1
f
C
L
K
f
H
O
C
O
F
R
Q
S
E
L
4
o
f
o
p
ti
o
n
b
y
te
s
(
0
0
C
2
H
)
000B
001B
010B
011B
100B
101B
f
C
L
K
/2
f
C
L
K
/4
f
C
L
K
/8
f
C
L
K
/3
2
e
d
g
e
co
n
tro
l
T
M
C
L
K
S
T
C
L
K
0
:
in
p
u
t
in
v
a
li
d
1
:
in
p
u
t
v
a
lid
C
K
E
G
1
,
C
K
E
G
0
0
0
B
:
ri
si
n
g
e
d
g
e
0
1
B
:
fa
lli
n
g
e
d
g
e
1
0
B
:
d
o
u
b
le
e
d
g
e
TC
K
2
~
TC
K
0
TS
TA
R
T0
0
:
S
to
p
c
o
u
n
ti
n
g
1
:
S
ta
rt
c
o
u
n
tin
g
T
M
0
T
im
e
r
M
c
o
u
n
te
r
0
T
M
G
R
A
0
T
im
e
r
M
g
e
n
e
ra
l
re
g
is
te
r
A
0
(
co
m
p
a
re
)
c
o
u
n
ti
n
g
s
e
le
c
ti
o
n
c
o
m
p
a
ra
to
r
c
ir
c
u
it
O
V
F
o
v
e
rf
lo
w
s
ig
n
a
l
c
o
m
p
a
re
m
a
tc
h
in
g
s
ig
n
a
l
(P
e
ri
o
d
)
C
S
E
L
0
0
:
st
o
p
co
u
n
ti
n
g
w
ih
le
T
MG
R
A0
co
mp
a
re
ma
t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