English
Language : 

MC9S08QG8 Datasheet, PDF (230/300 Pages) Freescale Semiconductor, Inc – 8-BIT HCS08 Central Processor Unit
Timer/PWM (S08TPMV2)
effectively make the counter free running.) Software can read the counter value at any time without
affecting the counting sequence. Any write to either byte of the TPMCNT counter resets the counter
regardless of the data value written.
All TPM channels are programmable independently as input capture, output compare, or buffered
edge-aligned PWM channels.
16.2 External Signal Description
When any pin associated with the timer is configured as a timer input, a passive pullup can be enabled.
After reset, the TPM modules are disabled and all pins default to general-purpose inputs with the passive
pullups disabled.
16.2.1 External TPM Clock Sources
When control bits CLKSB:CLKSA in the timer status and control register are set to 1:1, the prescaler and
consequently the 16-bit counter for TPM are driven by an external clock source, TPMxCLK, connected to
an I/O pin. A synchronizer is needed between the external clock and the rest of the TPM. This synchronizer
is clocked by the bus clock so the frequency of the external source must be less than one-half the frequency
of the bus rate clock. The upper frequency limit for this external clock source is specified to be one-fourth
the bus frequency to conservatively accommodate duty cycle and phase-locked loop (PLL) or
frequency-locked loop (FLL) frequency jitter effects.
On some devices the external clock input is shared with one of the TPM channels. When a TPM channel
is shared as the external clock input, the associated TPM channel cannot use the pin. (The channel can still
be used in output compare mode as a software timer.) Also, if one of the TPM channels is used as the
external clock input, the corresponding ELSnB:ELSnA control bits must be set to 0:0 so the channel is not
trying to use the same pin.
16.2.2 TPMCHn — TPM Channel n I/O Pins
Each TPM channel is associated with an I/O pin on the MCU. The function of this pin depends on the
configuration of the channel. In some cases, no pin function is needed so the pin reverts to being controlled
by general-purpose I/O controls. When a timer has control of a port pin, the port data and data direction
registers do not affect the related pin(s). See the Pins and Connections chapter for additional information
about shared pin functions.
16.3 Register Definition
The TPM includes:
• An 8-bit status and control register (TPMSC)
• A 16-bit counter (TPMCNTH:TPMCNTL)
• A 16-bit modulo register (TPMMODH:TPMMODL)
Each timer channel has:
• An 8-bit status and control register (TPMCnSC)
MC9S08QG8 and MC9S08QG4 Data Sheet, Rev. 1.01
230
Freescale Semiconductor