Pulse-Width Modulator for Motor Control (PWMMC)
PWM Generators
MC68HC908MR16/MC68HC908MR32 — Rev. 4.0 Advance Information
MOTOROLA Pulse-Width Modulator for Motor Control (PWMMC) 145
To prevent a partial reload of PWM parameters from occurring while the
software is still calculating them, an interlock bit controlled from software
is provided. This bit informs the PWM module that all the PWM
parameters have been calculated, and it is “okay” to use them. A new
modulus, prescaler, and/or PWM value cannot be lo aded into the PW M
module until the LDOK bit in PWM control register 1 is set. When the
LDOK bit is set, these new values are loaded into a second set of
registers and used by the PWM generator at the beginning of the next
PWM reload cycle as shown in Figure 9-7, Figure 9-8, Figure 9-9, and
Figure 9-10. After these values are loaded, the LDOK bit is cleared.
NOTE: When the PWM module is enabled (via the PWMEN bit), a load will occur
if the LDOK bit is set. Even if it is not set, an interrupt will occur if the
PWMINT bit is set. To prevent this, the software should clear the
PWMINT bit before enabling the PWM module.
Figure 9-7. Center-Aligned PWM Value Loading
Figure 9-8. Center-Aligned Loading of Modulus
LDOK = 1
MODULUS = 3
PWM VALUE = 1
LDOK = 1
MODULUS = 3
PWM VALUE = 2
UP/DOWN
COUNTER
PWM
LDFQ1:LDFQ0 = 00 (RELOAD EVERY CYCLE)
LDOK = 0
MODULUS = 3
PWM VALUE = 2
LDOK = 0
MODULUS = 3
PWM VALUE = 1
PWMF SET PWMF SET PWMF SET PWMF SET
LDOK = 1
PWM VALUE = 1
MODULUS = 2 LDOK = 1
PWM VALUE = 1
MODULUS = 3 LDOK = 1
PWMVALUE = 1
MODULUS = 2 LDOK = 1
PWM VALUE = 1
MODULUS = 1 LDOK = 0
PWM VALUE = 1
MODULUS = 2
UP/DOWN
COUNTER
PWM
LDFQ1:LDFQ0 = 00 (RELOAD EVERY CYCLE)
PWMF SET PWM F SET PWMF SE T PWMF SET PWMF SET