206
Timer A
M
i
t
s
u
M
S
b
i
s
3
M
h
0
I
C
i
m
2
R
i
1
O
c
r
8
C
o
c
o
G
M
m
p
r
P
u
t
u
T
e
r
p
R
s
o
U
S
I
N
G
L
E
-
C
H
I
P
1
6
-
B
I
T
C
M
O
O
E
2.2.12 Operation of Timer A (pulse width modulation mode, 8-bit PWM mode selected)
Figure 2.2.26. Operation timing of pulse width modulation mode, with 8-bit PWM mode selected
In pulse width modulation mode, choose functions from those listed in Table 2.2.12. Operations of the
circled items are described below. Figure 2.2.26 shows the operation timing, and Figure 2.2.27 shows the
set-up procedure.
Table 2.2.12. Choosed functions
Item
Note: j = i – 1, but j = 4 when i = 0; k = i + 1, but k = 0 when i = 4.
(1)
If the TAi
IN
pin input level changes from “H” to “L” with the count start flag set to “1”, the counter
performs a down count on the count source. Also, the TAi
OUT
pin outputs an “H” level.
(2) The TAi
OUT
pin output level changes from “H” to “L” when a set time period elapses. At this
time, the timer Ai interrupt request bit goes to “1”.
(3) The counter reloads the content of the reload register every time PWM pulses are output for
one cycle, and continues counting.
(4) Setting the count start flag to “0” causes the counter to hold its value and to stop. Also, the
TAi
OUT
pin outputs an “L” level.
The period of PWM pulses becomes (m + 1) X (2
8
– 1) / fi, and the “H” level pulse width
becomes n X (m + 1) / fi. If “00
16
” is set in the eight higher-order bits of the timer Ai register, the
pulse width modulator does not work, and the TAi
OUT
pin output level remains at “L”.
(fi : frequency of the count source f
1
, f
8
, f
32
, fc
32
; n : value of the timer)
When a trigger is generated, the TAi
OUT
pin outputs “L” level of same amplitude as “H” level of
the set PWM pulse, after which it starts PWM pulse output.
Operation
Note
Count source
PWM mode
Count start condition
Set-up
O
O
O
Internal count source (f
1
/ f
8
/ f
32
/ fc
32
)
16-bit PWM
8-bit PWM
External trigger input (falling edge of input signal to the TAi
IN
pin)
External trigger input (rising edge of input signal to the TAi
IN
pin)
Timer overflow (TB2/TAj/TAk overflow)
Count source (Note 1)
Reload register high-order 8 bits = 02
16
Reload register low-order 8 bits = 02
16
External trigger (falling edge of TAi
IN
pin input signal) is selected
1 / f
i
X (m
+ 1) X (2 – 1)
TA
iIN
pin input
Underflow signal of 8-bit
prescaler (Note 2)
PWM pulse output from
TA
iOUT
pin
“H”
AAAAAAAAAAAAAAA
“H”
AAAAAAAAAAAAAAA
“H”
1 / f
i
X (m + 1) X n
“L”
Timer Ai interrupt
request bit
“L”
“1”
“0”
Note 1: The 8-bit prescaler counts the count source.
Note 2: The 8-bit pulse width modulator counts the 8-bit prescaler's underflow signal.
Note 3: m = 00
16
to FE
16
; n = 00
16
to FE
16
.
Count start flag
“1”
“0”
(1) Start count
(2) Output level “H” to “L”
Cleared to “0” when interrupt request
is accepted, or cleared by software
(3)
(4) Stop count
1 / f
i
X (m+1)
Conditions:
One period is
complete