
MOTOROLA
MC68341 USER’S MANUAL
8- 7
This mode can be used as a pulse-width modulator by programming the CR OCx bits to
zero mode or one mode. The value in the PREL1 specifies the frequency, and the COM
determines the pulse width. The pulse widths can be changed by writing a new value to
the COM.
Periodic interrupt generation can be accomplished by enabling the TO, TG, and/or TC bits
in the SR to generate interrupts by programming the IE bits of the CR. When enabled, the
programmed IRQ≈ signal is asserted whenever the specified bits are set.
TOUT signal transitions can be controlled by writing new values into the COM. Caution
must be exercised when accessing the COM. If it were to be accessed simultaneously by
the compare logic and by a write, the old compare value may actually get compared to the
counter value.
8.3.2 Square-Wave Generator
This mode can be used for generating both square-wave output and periodic interrupts.
The square wave is generated by counting down from the value in the PREL1 to time-out
(counter value of $0000). TOUT changes state on each time-out as programmed. This
mode can be selected by programming the CR MODEx bits to 001.
The timer is enabled by setting the SWR and CPE bits in the CR and, if TGATE is
programmed to control the enabling and disabling of the counter (TGE bit set in the CR),
then asserting TGATE. When the timer is enabled, the ON bit in the SR is set. On the next
falling edge of the counter clock, the counter is loaded with the value stored in the PREL1
(N). With each successive falling edge of the counter clock, the counter decrements. The
time between enabling the timer and the first time-out can range from N to N + 1 periods.
When TGATE is used to enable the timer, the enabling of the timer is asynchronous;
however, if timing is carefully considered, the time to the first time-out can be known. For
additional details on timing, see Section 12 Electrical Characteristics.
TOUT behaves as a square wave when the OCx bits of the CR are programmed for toggle
mode. A time-out occurs every N + 1 periods (allowing for the zero cycle), resulting in a
change of state on TOUT (see Figure 8-5). The SR OUT bit reflects the level of TOUT. If
this mode is used to generate periodic interrupts, TOUT may be enabled if a square wave
is also desired.
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
..
.