
MC9S08GB/GT Data Sheet, Rev. 2.3
Freescale Semiconductor
151
Chapter 10 Timer/PWM (TPM) Module
10.1
Introduction
The MC9S08GB/GT includes two independent timer/PWM (TPM) modules which support traditional
input capture, output compare, or buffered edge-aligned pulse-width modulation (PWM) on each channel.
A control bit in each TPM congures all channels in that timer to operate as center-aligned PWM
functions. In each of these two TPMs, timing functions are based on a separate 16-bit counter with
prescaler and modulo features to control frequency and range (period between overows) of the time
reference. This timing system is ideally suited for a wide range of control applications, and the
center-aligned PWM capability on the 3-channel TPM extends the eld of applications to motor control in
small appliances.
The use of the xed system clock, XCLK, as the clock source for either of the TPM modules allows the
TPM prescaler to run using the oscillator rate divided by two (ICGERCLK/2). This clock source must be
selected only if the ICG is congured in either FBE or FEE mode. In FBE mode, this selection is redundant
because the BUSCLK frequency is the same as XCLK. In FEE mode, the proper conditions must be met
clock source with the ICG in either FEI or SCM mode will result in the TPM being non-functional.
10.2
Features
The timer system in the MC9S08GB60 includes a 3-channel TPM1 and a separate 5-channel TPM2; the
timer system in the MC9S08GB32 includes two 2-channel modules, TPM1 and TPM2. Timer system
features include:
A total of eight channels:
— Each channel may be input capture, output compare, or buffered edge-aligned PWM
— Rising-edge, falling-edge, or any-edge input capture trigger
— Set, clear, or toggle output compare action
— Selectable polarity on PWM outputs
Each TPM may be congured for buffered, center-aligned pulse-width modulation (CPWM) on all
channels
Clock source to prescaler for each TPM is independently selectable as bus clock, xed system
clock, or an external pin
Prescale taps for divide by 1, 2, 4, 8, 16, 32, 64, or 128
16-bit free-running or up/down (CPWM) count operation
16-bit modulus register to control counter range
Timer system enable
One interrupt per channel plus terminal count interrupt