R01UH0092EJ0110 Rev.1.10
Page 398 of 807
Jul 31, 2012
M16C/64C Group
21. Pulse Width Modulator
21.2.2
PWMi Prescaler (PWMPREi) (i = 0, 1)
21.2.3
PWMi Register (PWMREGi) (i = 0, 1)
The PWMi register (i = 0, 1) sets the PWMi cycle (i = 0, 1) and high-level pulse width. The PWM cycle
and high-level pulse width are given by:
PWM cycle =
(Units: s)
High level pulse width =
(Units: s)
fj: PWM count source frequency (Unit: Hz)
m: PWMPREi register setting
n: PWMREGi register setting
The value written in the PWMPREi register is written to the PWMi prescaler prelatch. At the beginning
of the next PWM cycle, the PWMi prescalser prelatch value is transferred to the PWMi prescaler latch
and the PWMi prescaler, and then the associated PWMi waveform is output.
The value written in the PWMREGi register is written to the PWMi register prelatch. At the beginning of
the next PWM cycle, the PWMi register prelatch value is transferred to the PWMi register latch and the
PWMi register, and then the associated PWMi waveform is output.
When rewriting the PWMPREi and PWMREGi register values while the PWMENi bit in the PWMCON1
register is 0 (PWMi output disabled), after the PWMENi bit is set to 1 (PWMi output enabled), the
values prior to being rewritten are reflected in the first cycle of PWM output.
Refer 21.3.2 “Operation Example” for output waveforms and transfer timings.
When reading the PWMPREi register while the PWMENi bit is 0 (PWMi output disabled), the PWMi
prescaler prelatch value is read. Also, when reading the PWMREGi register, the PWMi register latch
value is read (See Figure 21.1 “Block Diagram of PWM”). When reading registers PWMPREi and
PWMREGi while the PWMENi bit is 1 (PWMi output enabled), an undefined value is read.
b7
PWMi Prescaler (i = 0, 1)
Symbol
PWMPRE0
PWMPRE1
Address
0372h
0374h
Function
RW
Reset Value
00h
00h
RW
b0
Setting Range
PWM cycle
00h to FFh
b7
PWMi Register (i = 0, 1)
Symbol
PWMREG0
PWMREG1
Address
0373h
0375h
Function
RW
Reset Value
00h
00h
RW
b0
Setting Range
Output high-level pulse width
00h to FFh
2
8
1
–
(
)
m
1
+
(
)
×
fj
--------------------------------------------
m
1
+
(
)
n
×
fj
---------------------------
Содержание M16C Series
Страница 846: ...M16C 64C Group R01UH0092EJ0110...