17-50
MPC561/MPC563 Reference Manual
MOTOROLA
MIOS14 Pulse Width Modulation Submodule (MPWMSM)
17.10.3.1 Clock Selection
The MPWMSM contains an 8-bit prescaler clocked by the output signal from the MIOS14
counter prescaler submodule (fSYS/2 to fSYS/16). The MPWMSM clock selector allows the
choice, by software, of one of 256 divide ratios which give to the MPWMSM a large choice
of frequencies available for the down-counter. The MPWMSM down-counter is thus
capable of counting with a clock frequency ranging from fSYS/2 to fSYS/4096.
Switching the MPWMSM from disable to enable will reload the value of MPWMSCR[CP]
into the 8-bit prescaler counter.
17.10.3.2 Counter
A 16-bit down-counter in the MPWMSM provides the time reference for the output signal.
The counter is software writable. When writing to the counter (i.e., at the MPWMCNTR
address), it also writes to the MPWMPERR register. When in transparent mode (TRSP =
1), writing to the MPWMPERR will also write to the counter. The down-counter is readable
at anytime. The value loaded in the down-counter corresponds to the period of the output
signal.
When the MPWMSM is enabled, the counter begins counting. As long as it is enabled, the
counter counts down freely. The counter counts at the rate established by the prescaler.
When the count down reaches 0x0001, the load operation is executed and the value in the
MPWMPERR register is loaded in the MPWMCNTR register, (i.e., the counter). Then the
counter restarts to count down from that value.
17.10.3.3 Period Register
The period section is composed of a 16-bit data register (MPWMPERR). The software
establishes the period of the output signal in register MPWMPERR.
When the MPWMSM is running in transparent mode, the period value in register
MPWMPERR is immediately transferred to the counter on a write to the MPWMPERR.
When the MPWMSM is running in double-buffered mode, the period value in register
MPWMPERR can be changed at any time without affecting the current period of the output
signal. The new value of MPWMPERR will be transferred to the counter only when the
counter reaches the value of 0x0001 and generates a load signal.
Period values of 0x0000, 0x0001, and 0x0002 are MPWMSM special cases:
The value 0x0000 in the period register, causes the counter to act like a free running
counter. This condition creates a period of 65536 PWM clock periods.
The value 0x0001 in the period register will always cause a period match to occur
and the counter will never decrement below 0x0001. This condition is defined as a
period of “1” PWM clock count. The output flip-flop is always set unless
MPWMPULR = 0x0000, when the output flip-flop is always reset. Refer to