
8- 6
MC68341 USER’S MANUAL
MOTOROLA
the CNTR shadows the actual value of the counter. The timer gate interrupt (TG) bit in the
SR must be cleared for shadowing to occur. TGATE is used to set the TG bit and disable
shadowing. If the timing gate is enabled (TGE bit of the CR is set), the TG bit is set by the
rising edge of TGATE. Shadowing is disabled until the TG bit is cleared by writing a one to
its location in the SR. See Figure 8-4 for a depiction of this mode. If the timing gate is
disabled (CR TGE bit is cleared), TGATE has no effect on the operation of the timer; thus
the input capture function is inoperative. At all times, the TGATE level bit (TGL) in the SR
reflects the level of the TGATE signal.
COUNTER
CLOCK
COUNTER
REGISTER
TGATE
TOUT
Modex Bits in Control Register = 000
Preload 1 Register = 8
Compare Register = 7
TGE Bit of Status Register = 1
TG Bit in Status Register Initially = 0
OCx Bits in Control Register = 10
0
8
7
6
5
4
3
2
1
0
7
8
0
1
2
3
4
5
6
7
8
0
8
7
6
2
1
0
8
0
1
2
3
6
7
8
0
TG SET
TG CLEARED
TG SET
TIMEOUT
TC SET
ENABLE
Figure 8-4. Input Capture/Output Compare Mode
Since the counter is not affected by TGATE, it continues to decrement on the falling edge
of the counter clock and load from the PREL1 at time-out, regardless of the value of
TGATE.
When the counter counts down to the value contained in the COM, this condition is
reflected by setting the timer compare (TC) and compare (COM) bits in the SR. TOUT
responds as selected by the OCx bits in the CR. The output level (OUT) bit in the SR
reflects the value on TOUT. Shadowing does not affect this operation.
If the counter counts down to $0000, a time-out is detected, causing the SR time-out
interrupt (TO) bit to be set and the SR COM bit to be cleared. On the next falling edge of
the counter clock after the time-out is detected, the value in PREL1 is again loaded into
the counter. TOUT responds as selected by the CR OCx bits.
A square-wave generator can be implemented by programming the CR OCx bits to toggle
mode. The value in the COM should be one-half the value in PREL1 to cause an event to
happen twice in the countdown.
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.