17-72
MPC561/MPC563 Reference Manual
MOTOROLA
MIOS14 Function Examples
17.13 MIOS14 Function Examples
The versatility of the MIOS14 timer architecture is based on multiple counters and
capture/compare channel units interconnected on 16-bit counter buses. This section
includes some typical application examples to show how the submodules can be
interconnected to form timing functions. The diagrams used to illustrate these examples
show only the blocks utilized for that function.
To illustrate the timing range of the MIOS14 in different applications, many of the
following paragraphs include time intervals quoted in microseconds and seconds. The
assumptions used are that fSYS is at 40 MHz with minimum overall prescaling (50 ns cycle)
and with the maximum overall prescaling (32 s cycle). For other fSYS clock cycle rates
and prescaler choices, the times mentioned in these paragraphs scale appropriately.
17.13.1
MIOS14 Input Double Edge Pulse Width
Measurement
To measure the width of an input pulse, the MIOS14 double action submodule (MDASM)
has two capture registers so that only one interrupt is needed after the second edge. The
software can read both edge samples and subtract them to get the pulse width. The leading
edge sample is double latched so that the software has the time of one full period of the
input signal to read the samples to be sure that nothing is lost. Depending on the prescaler
divide ratio, pulse width from 50 ns to 6.7 s can be measured. Note that a software option
is provided to also generate an interrupt after the first edge.
In the example shown in
Figure 17-43, a counter submodule is used as the time-base for a
MDASM configured in the input pulse width measurement mode. When the leading edge
(programmed for being either rising or falling) of the input signal occurs, the state of the
16-bit counter bus is saved in register B1. When the trailing edge occurs, the 16-bit counter
bus is latched into register A and the content of register B1 is transferred to register B2. This
operation leaves register B1 free for the next leading edge to occur on the next clock cycle.
When enabled, an interrupt is provided after the trailing edge, to notify the software that
pulse width measurement data is available for a new pulse. After the trailing edge, the
software has one cycle time of the input signal to obtain the values for each edge. When
software attention is not needed for every pulse, the interrupt can be disabled. The software
Table 17-43. MIOS14LVL1 Bit Descriptions
Bits
Name
Description
0:4
—
Reserved
5:7
LVL
Interrupt request level. This field represents one of eight possible levels.
8:9
TM
Time multiplexing. This field determines the multiplexed time slot.
10:15
—
Reserved