
MOTOROLA
Chapter 17. Modular Input/Output Subsystem (MIOS14)
17-51
MIOS14 Pulse Width Modulation Submodule (MPWMSM)
duty cycles.
Writing value 0x0002 in the period register causes a period match to occur every two
clock periods. The counter decrements from 0x0002 to 0x0001, and then it is
initialized back to 0x0002. This condition is defined as a period of 2 clock counts.
Note that the value 0x0002 loaded in the period register and a value of 0x0001 in the
pulse width register is the condition to obtain the maximum possible output
frequency for a given clock period.
The relationship between the output frequency obtained (FPWMO) and the MIOS14
CLOCK frequency (fSYS), the MCPSM clock divide ratio (NMCPSM), the counter divide
ratio (NMPWMSM) and the value loaded in the counter (VCOUNTER) is given by the
following equation:
17.10.3.4 Pulse Width Registers
The pulse width section is composed of two 16-bit data registers (MPWMPULR1 and
MPWMPULR2). Only MPWMPULR1 is accessible by software. The software establishes
the pulse width of the MPWMSM output signal in MPWMPULR1. MPWMPULR2 is used
as a double buffer of MPWMPULR1.
When the MPWMSM is running in transparent mode, the pulse width value in
MPWMPULR1 is immediately transferred in MPWMPULR2 so that the new value takes
effect immediately.
NOTE
When the MPWMSM is in disable mode, writing to
MPWMPULR1 will write automatically to MPWMPULR2.
When the MPWMSM is not running in double-buffered mode, the pulse width value in
MPWMPULR1 can be changed at any time without affecting the current pulse width of the
output signal. The new value in MPWMPULR1 will be transferred to MPWMPULR2 only
when the down-counter reaches the value of 0x0001.
When the counter first reaches the value in MPWMPULR2, the output flip-flop is set. The
output is reset when the counter reaches 0x0001. The pulse width match starts the width of
the output signal, it does not affect the counter. MPWMPULR1 is software readable and
writable at any time. The MPWMSM does not modify the content of MPWMPULR1.
The PWM output pulse width can be as wide as one period minus one MPWMSM clock
count: (i.e., MPWMPULR2 = MPWMPERR — [one MPWMSM clock count]). At the
fPWMO =
fSYS
NMCPSM NMPWMSM VCOUNTER