
Standard Timer Module
MC68HC812A4 Data Sheet, Rev. 7
122
Freescale Semiconductor
12.4 Functional Description
This section provides a functional description of the standard timer.
12.4.1 Prescaler
The prescaler divides the module clock by 1, 2, 4, 8, 16, or 32. The prescaler select bits, PR2, PR1, and
PR0, select the prescaler divisor. PR2, PR1, and PR0 are in the timer mask 2 register (TMSK2).
12.4.2 Input Capture
Clearing the I/O (input/output) select bit, IOSx, configures channel x 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 timer counter into the timer
channel registers, TIMCxH and TIMCxL.
In 8-bit MCUs, the low byte of the timer channel register (TIMCxL) is held for one bus cycle after the high
byte (TIMCxH) is read. This allows coherent reading of the timer channel such that an input capture does
not occur between two back-to-back 8-bit reads. To read the 16-bit timer channel register, use a
double-byte read instruction such as LDD or LDX.
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 timer port data direction register controls the
data direction of an input capture pin. Pin conditions can trigger an input capture on a pin configured as
an input. Software can trigger an input capture on an input capture pin configured as an output.
An input capture on channel x sets the CxF flag. The CxI bit enables the CxF flag to generate interrupt
requests.
12.4.3 Output Compare
Setting the I/O select bit, IOSx, configures channel x as an output compare channel. The output compare
function can generate a periodic pulse with a programmable polarity, duration, and frequency. When the
timer 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 x sets the CxF flag. The CxI bit enables
the CxF flag to generate interrupt requests.
The output mode and level bits, OMx and OLx, select set, clear, or toggle on output compare. Clearing
both OMx and OLx disconnects the pin from the output logic.
$00AE
Timer Port Data Register
(PORTT)
See page 139.
Read:
PT7
PT6
PT5
PT4
PT3
PT2
PT1
PT0
Write:
Reset:
Unaffected by reset
$00AF
Timer Port Data Direction
Register (DDRT)
See page 140.
Read:
Bit 7
5
5
4
3
2
1
Bit 0
Write:
Reset:
0
0
0
0
0
0
0
0
Addr.
Register Name
Bit 7
6
5
4
3
2
1
Bit 0
= Unimplemented
R
= Reserved
Figure 12-2. I/O Register Summary (Sheet 4 of 4)