Rev. 1.0, 02/00, page 385 of 1141
20.3
14-Bit PWM Operation
When using the 14-bit PWM, set the registers in this sequence:
1. Set bit PWM40 to 1 in port mode register 4 (PMR4) so that pin P40/PWM14 is designated for
PWM output.
2. Set bit PWCR0 in the PWM control register (PWCR) to select a conversion period of either
32768/
φ
(PWCR0 = 1) or 16384/
φ
(PWCR0 = 0).
3. Set the output waveform data in PWM data registers U and L (PWDRU, PWDRL). Be sure to
write byte data first to PWDRL and then to PWDRU. When the data is written in PWDRU,
the contents of these registers are latched in the PWM waveform generator, and the PWM
waveform generation data is updated in synchronization with internal signals.
One conversion period consists of 64 pulses, as shown in figure 20.2. The total high-level width
during this period (T
H
) corresponds to the data in PWDRU and PWDRL. This relation can be
expressed as follows:
T
H
= (data value in PWDRU and PWDRL + 64)
×
t
φ
/2
where to is the period of PWM clock input: 2/
φ
(bit PWCR0 = 0) or 4/
φ
(bit PWCR0 = 1).
If the data value in PWDRU and PWDRL is from H'3FC0 to H'3FFF, the PWM output stays high.
When the data value is H'0000, T
H
is calculated as follows:
T
H
= 64
×
t
φ
/2 = 32
⋅
t
φ
t H64
t H63
t H3
t H2
t H1
T H = t H1 + t H2 + t H3 + ... + t H64
t f1 = t f2 = t f3 = ... = t f64
t f1
t f2
t f63
t f64
1 conversion period
Figure 20.2 Waveform Output by 14-Bit PWM