
MOTOROLA
1-8
CTM
REFERENCE
FUNCTIONAL OVERVIEW
For More Information On This Product,
Go to: www.freescale.com
1
compare register. The output compare function is configured to generate a high or low output
automatically on the pin, or to toggle the state on the pin, when the match occurs. The output
compare register is loaded with a new value after the compare occurs. Typically, more than one
output compare function is associated with each pin; because pin state changes occur
automatically at specific values of the free-running counter, the pulse width can be controlled to
the resolution of the free-running counter independent of software latencies. A periodic pulse of a
specific frequency and duty cycle can be generated by repeating the above steps.
1.8
Pulse accumulator (PA) concepts
Pulse accumulator systems are usually based on 8 or 16 bits. A typical 16-bit pulse accumulator
is shown in Figure 1-7; it consists of a 16-bit counter and edge select logic, and has two modes of
operation: event counting mode and gated mode. In event counting mode, the counter is
incremented each time an event occurs. In gated mode, an internal clock source increments the
counter while a selected level is present on the input pin (the gate). When the signal on the input
pin is negated, the counter is stopped. Two status flags are available: one to indicate the
occurrence of an event, and the other to indicate counter overflow. Either of these flags can cause
the processor to be interrupted.
The pulse accumulator can be used, for example, to count the number of items going by on a
conveyor belt or the number of teeth that have gone by on a crankshaft timing gear. As each item
or tooth is detected, the counter is incremented (event counting mode). The counter therefore
contains the number of items (or teeth). The flag indicates the occurrence of an event (an item or
tooth went by). If interrupts are enabled, an interrupt is generated. Software can read the counter
at this time.
Figure 1-7
Simplified block diagram of a typical pulse accumulator
16-bit counter
16-bit counter
Clock
Event
&
Event
Event counting mode
Gated time accumulator mode
F
.
Freescale Semiconductor, Inc.