Chapter 16 Timer/PWM Module (S08TPMV3)
MC9S08SG32 Data Sheet, Rev. 7
Freescale Semiconductor
261
16.6.2.1.2
Center-Aligned PWM Case
When CPWMS=1, TOF gets set when the timer counter changes direction from up-counting to
down-counting at the end of the terminal count (the value in the modulo register). In this case the TOF
corresponds to the end of a PWM period.
16.6.2.2
Channel Event Interrupt Description
The meaning of channel interrupts depends on the channel’s current mode (input-capture, output-compare,
edge-aligned PWM, or center-aligned PWM).
16.6.2.2.1
Input Capture Events
When a channel is congured as an input capture channel, the ELSnB:ELSnA control bits select no edge
(off), rising edges, falling edges or any edge as the edge which triggers an input capture event. When the
selected edge is detected, the interrupt ag is set. The ag is cleared by the two-step sequence described
16.6.2.2.2
Output Compare Events
When a channel is congured as an output compare channel, the interrupt ag is set each time the main
timer counter matches the 16-bit value in the channel value register. The ag is cleared by the two-step
16.6.2.2.3
PWM End-of-Duty-Cycle Events
For channels congured for PWM operation there are two possibilities. When the channel is congured
for edge-aligned PWM, the channel ag gets set when the timer counter matches the channel value register
which marks the end of the active duty cycle period. When the channel is congured for center-aligned
PWM, the timer count matches the channel value register twice during each PWM cycle. In this CPWM
case, the channel ag is set at the start and at the end of the active duty cycle period which are the times
when the timer counter matches the channel value register. The ag is cleared by the two-step sequence
16.7
The Differences from TPM v2 to TPM v3
Any write to TPMxCNTH or TPMxCNTL registers in TPM v3 clears the TPM counter
(TPMxCNTH:L) and the prescaler counter. Instead, in the TPM v2 only the TPM counter is cleared
in this case.
— In TPM v3, any read of TPMxCNTH:L registers during BDM mode returns the value of the
TPM counter that is frozen. In TPM v2, if only one byte of the TPMxCNTH:L registers was
read before the BDM mode became active, then any read of TPMxCNTH:L registers during