MOTOROLA
Chapter 17. Modular Input/Output Subsystem (MIOS14)
17-73
MIOS14 Function Examples
can read registers A and B2 coherently (using a 32-bit read instruction) at any time, to get
the latest edge measurements. The software work is less than half that needed with a timer
that requires the software to read one edge and save the value and then wait for the second
edge.
Figure 17-43. MIOS14 Example: Double Capture Pulse Width Measurement
17.13.2
MIOS14 Input Double Edge Period Measurement
Two samples are available to the software from an MIOS14 double action submodule for
period measurement. The software can read the previous and the current edge samples and
subtract them. As with pulse width measurement, the software can be sure not to miss
samples by ensuring that the interrupt response time is faster than the fastest input period.
Alternately, when the software is just interested in the latest period measurement, one 32-bit
coherent read instruction can get both the current and the previous samples. Depending on
the prescaler divide ratio, period times can be measured from 50 ns to 6.7 s.
Figure 17-44 shows a counter submodule and a DASM combination as an example of
period measurement. The software designates whether the rising or falling edge of the input
signal is to be used for the measurements. When the edge is detected, the state of the 16-bit
counter bus is stored in register A and the content of register B1 is transferred to register
B2. After register B2 is safely latched, the content of register A is transferred to register B1.
This procedure gives the software coherent current and previous samples in registers A and
B2 at all times. An interrupt is available for the cases where the software needs to be aware
of each new sample. Note that a software option is provided to also generate an interrupt
after the first edge.
16-bit Up-Counter
Submodule Bus
Clock
Select
16-bit Register B1
Edge
Detect
Input
Signal
16-bit Register A
Input
Capture
Interrupt
on
From
Prescaler
or Pin
Trailing
Bus
Select
Edge
Two
16-bit
Counter
Buses
16-bit Register B2
MIOS14 Modulus Counter Submodule
MIOS14 Double Action Submodule
in IPWM mode (MOD3-MOD0 = 0b0001)