
8- 12
MC68341 USER’S MANUAL
MOTOROLA
COUNTER
CLOCK
TGATE
0
f
e
d
c
MEASURED PULSE
f
b
f
b
START
COUNTING
ENABLE
STOP
COUNTING
NO EFFECT
MODEx Bits in Control Register = 100
TGE Bit of Control Register = 1
COUNTER
Figure 8-8. Pulse-Width Measurement Mode
If the counter counts down to the value stored in the COM register, the COM and TC bits
in the SR are set. If the counter counts down to $0000, a time-out is detected. This sets
the SR TO, and the clears the COM bit. At time-out, the next falling edge of the counter
clock causes the counter to reload with $FFFF. TOUT transitions at time-out or is disabled
as programmed by the CR OCx bits. The SR OUT bit reflects the level on TOUT.
To determine the number of cycles counted, the value in the CNTR must be read,
inverted, and incremented by 1 (the first count is $FFFF which, in effect, includes a count
of zero). The counter counts in a true 216 fashion. For measuring pulses of even greater
duration, the value in the POx bits in the SR is readable and can be thought of as an
extension of the least significant bits in the CNTR.
NOTE
Once the timer has been enabled, do not clear the SR TG bit
until the pulse has been measured and TGATE has been
negated.
8.3.6 Period Measurement
This mode is used to count the period of a particular event. The event is defined by the
assertion, negation, and subsequent reassertion of TGATE . When TGATE is asserted, the
counter begins counting down from $FFFF. The negation of TGATE has no effect on the
counter. When TGATE is reasserted, the counter stops counting and holds the value at
which it stopped. Further assertions and negations of TGATE have no effect on the
counter. This mode can be selected by programming the CR MODEx bits to 101.
The timer is enabled by setting the SWR, CPE, and the TGE bits in the CR. The assertion
of TGATE starts the counter. When the timer is enabled, the SR ON bit is set. On the next
falling edge of the counter clock, the counter is loaded with the value of $FFFF. With each
successive falling edge of the counter clock, the counter decrements. The PREL1 and
PREL2 registers are not used in this mode.
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
Go to: www.freescale.com
n
c
..
.