Intel 8XC196MC Microscope & Magnifier User Manual


 
11-13
EVENT PROCESSOR ARRAY (EPA)
11.4.1.2 Preventing EPA Overruns
Any one of the following methods can be used to prevent or recover from an EPA overrun situa-
tion.
Clear EPAx_CON.0
When the overwrite bit (EPAx_CON.0) is zero, the EPA does not consider the captured
edge until the EPAx_TIME register is read and the data in the capture buffer is transferred to
EPAx_TIME. This prevents overruns by ignoring new input capture events when both the
capture buffer and EPAx_TIME contain valid capture times.
Check for pending EPAx interrupts before exiting an EPAx ISR
Another method for avoiding this situation is to check for pending EPA interrupts before
exiting the EPA interrupt service routine. This is an easy way to detect overruns and addi-
tional interrupts. It can also save loop time by eliminating the latency necessary to service
the pending interrupt. However, this method cannot be used with the peripheral transaction
server (PTS).
11.4.2 Operating in Compare Mode
When the selected timer value matches the event-time value, the action specified in the control
register occurs (i.e., the pin is set, cleared, or toggled, an A/D conversion is initiated, or the wave-
form generator is reloaded). If the re-enable bit (EPAx_CON.3) is set, the action reoccurs on ev-
ery timer match. If the re-enable bit is cleared, the action does not reoccur until a new value is
written to the event-time register. See “Programming the Capture/Compare Channels” on page
11-18 and “Programming the Compare-only Channels” on page 11-22 for configuration informa-
tion.
In compare mode, you can use the EPA to produce a pulse-width modulated (PWM) output. The
following sections describe two possible methods.
11.4.2.1 Generating a Low-speed PWM Output
You can generate a low-speed, pulse-width modulated output with a single EPA channel and a
standard interrupt service routine. Configure the EPA channel as follows: compare mode, toggle
output, and the compare function re-enabled. Select standard interrupt service, enable the EPA
interrupt, and globally enable interrupts with the EI instruction. When the assigned timer/counter
value matches the value in the event-time register, the EPA toggles the output pin and generates
an interrupt. The interrupt service routine loads a new value into EPAx_TIME.