16 16-BIT PWM TIMERS (T16A3)
16-10
Seiko epson Corporation
S1C17F13 TeChniCal Manual
(Rev. 1.0)
PWM waveform output and normal clock/half-clock mode
By setting the T16A
n
CCCTL.TOUTAMD[1:0] and/or TOUTBMD[1:0] bits to 0x1, T16A3 generates a PWM
waveform of which the cycle is determined by the compare B signal and the duty ratio is determined by the com-
pare A signal. T16A3 supports half-clock mode to improve the accuracy of the PWM output waveform duty
ratio. In half-clock mode (T16A
n
CTL.HCM bit = 1), T16A3 uses the dual-edge counter, which counts at the
rising and falling edges of the count clock, to compare with the compare A register. This makes it possible to
control the duty ratio with double accuracy as compared to normal clock mode (T16A
n
CTL.HCM bit = 0).
Notes:
•
Be sure to avoid placing T16A3 to half-clock mode under a condition shown below.
(1) When T16A3 is placed into capture mode
(2) When the T16A
n
CCCTL.TOUTAMD[1:0] or TOUTBMD[1:0] bits are set to 0x2 or 0x3
•
The dual-edge counter value cannot be read.
•
Do not use the compare A interrupt in half-clock mode.
•
In half-clock mode, the T16A
n
CCB register setting value must be less than [T16A
n
CCA set-
ting value / 2 + 0x8000].
•
The compare B value (T16A
n
CCB register value) will be compared with the T16A
n
TC counter
value even if T16A3 Ch.
n
is set to half-clock mode.
Count clock
T16A
n
TC.T16ATC[15:0]
TOUTA
n
/TOUTB
n
T16A
n
CCA.CCA[15:0]
(When T16A
n
CCCTL.TOUTAMD[1:0] = TOUTBMD[1:0] = 0x1 and T16A
n
CCCTL.TOUTAINV = TOUTBINV = 0)
n
0
0
1
2
n-1
n
0
1
1
2
n-2
n-1
(n = T16A
n
CCB.CCB[15:0])
Count clock
T16A
n
TC.T16ATC[15:0]
TOUTA
n
/TOUTB
n
Example: T16A
n
CTL.HCM = 0, T16A
n
CCA.CCA[15:0] = 1, and T16A
n
CCB.CCB[15:0] = 5
(When T16A
n
CCCTL.TOUTAMD[1:0] = TOUTBMD[1:0] = 0x1 and T16A
n
CCCTL.TOUTAINV = TOUTBINV = 0)
5
0
1
2
4
5
0
1
3
4.4.3 PWM Waveform Output Timings in Normal Clock Mode
Figure 16.
Count clock
T16A
n
TC.T16ATC[15:0]
Dual-edge counter
TOUTA
n
/TOUTB
n
T16A
n
CCA.CCA[15:0]
(When T16A
n
CCCTL.TOUTAMD[1:0] = TOUTBMD[1:0] = 0x1 and T16A
n
CCCTL.TOUTAINV = TOUTBINV = 0)
n
2n
0
–
0
0
1
2
3
4
2n-3 2n-2 2n-1
2n
–
0
1
1
2
n-1
n
0
1
1
2
3
4
2n-4 2n-3 2n-2 2n-1
(n = T16A
n
CCB.CCB[15:0])
Count clock
T16A
n
TC.T16ATC[15:0]
Dual-edge counter
TOUTA
n
/TOUTB
n
Example: T16A
n
CTL.HCM = 1, T16A
n
CCA.CCA[15:0] = 1, and T16A
n
CCB.CCB[15:0] = 5
(When T16A
n
CCCTL.TOUTAMD[1:0] = TOUTBMD[1:0] = 0x1 and T16A
n
CCCTL.TOUTAINV = TOUTBINV = 0)
5
10
0
–
0
1
2
3
4
7
8
9
10
–
0
1
1
2
4
5
0
1
5
6
3
4.4.4 PWM Waveform Output Timings in Half-Clock Mode
Figure 16.