General Purpose Timer Module (GPT)
MCF52235 ColdFire® Integrated Microcontroller Reference Manual, Rev. 6
Freescale Semiconductor
23-17
23.7
Functional Description
The general purpose timer (GPT) module is a 16-bit, 4-channel timer with input capture and output
compare functions and a pulse accumulator.
23.7.1
Prescaler
The prescaler divides the module clock by 1 or 16. The PR[2:0] bits in GPTSCR2 select the prescaler
divisor.
23.7.2
Input Capture
Clearing an I/O select bit (IOS
n
) configures channel
n
as an input capture channel. The input capture
function captures the time at which an external event occurs. When an active edge occurs on the pin of an
input capture channel, the timer transfers the value in the GPT counter into the GPT channel registers
(GPTC
n
).
The minimum pulse width for the input capture input is greater than two module clocks.
The input capture function does not force data direction. The GPT port data direction register controls the
data direction of an input capture pin. Pin conditions such as rising or falling edges can trigger an input
capture only on a pin configured as an input.
An input capture on channel
n
sets the C
n
F flag. The C
n
I bit enables the C
n
F flag to generate interrupt
requests.
23.7.3
Output Compare
Setting an I/O select bit (IOS
n
) configures channel
n
as an output compare channel. The output compare
function can generate a periodic pulse with a programmable polarity, duration, and frequency. When the
GPT counter reaches the value in the channel registers of an output compare channel, the timer can set,
clear, or toggle the channel pin. An output compare on channel
n
sets the C
n
F flag. The C
n
I bit enables the
C
n
F flag to generate interrupt requests.
The output mode (OM
n)
and level bits (OL
n)
select, set, clear, or toggle on output compare. Clearing OM
n
and OL
n
disconnects the pin from the output logic.
Setting a force output compare bit (FOC
n
) causes an output compare on channel
n
. A forced output
compare does not set the channel flag.
A successful output compare on channel 3 overrides output compares on all other output compare
channels. A channel 3 output compare can cause bits in the output compare 3 data register to transfer to
the GPT port data register, depending on the output compare 3 mask register. The output compare 3 mask
register masks the bits in the output compare 3 data register. The GPT counter reset enable bit, TCRE,
enables channel 3 output compares to reset the GPT counter. A channel 3 output compare can reset the
GPT counter even if the OC3/PAI pin is being used as the pulse accumulator input.
An output compare overrides the data direction bit of the output compare pin but does not change the state
of the data direction bit.
Because
of
an
order
from
the
United
States
International
Trade
Commission,
BGA-packaged
product
lines
and
part
numbers
indicated
here
currently
are
not
available
from
Freescale
for
import
or
sale
in
the
United
States
prior
to
September
2010:MCF52234CVM60,
MCF52235CVM60