10-15
EVENT PROCESSOR ARRAY (EPA)
10.4.2.4 Generating the Highest-speed PWM Output
You can generate a highest-speed, pulse-width modulated output with a pair of EPA channels and
a dedicated timer/counter. The first channel toggles the output when the timer value matches
EPAx_TIME, and at some later time, the second channel toggles the output again and resets the
timer/counter. This restarts the cycle. No interrupts are required, resulting in the highest possible
speed. Software must calculate and load the appropriate EPAx_TIME values and load them at the
correct time in the cycle in order to change the frequency or duty cycle.
With this method, the resolution of the EPA (selected by the TxCONTROL registers; see Figure
10-8 on page 10-16 and Figure 10-9 on page 10-17) determines the maximum PWM output fre-
quency. (Resolution is the minimum time required between consecutive captures or compares.)
When the input frequency on XTAL1 is 25 MHz and the phase-locked loop is disabled on the
80C196NU, a 160 ns resolution results in a maximum PWM of 6.25 MHz.
10.5 PROGRAMMING THE EPA AND TIMER/COUNTERS
This section discusses configuring the port pins for the EPA and the timer/counters; describes
how to program the timers and the capture/compare channels; and explains how to enable the
EPA interrupts.
10.5.1 Configuring the EPA and Timer/Counter Port Pins
Before you can use the EPA, you must configure the pins of port 1 to serve as the special-function
signals for the EPA and, optionally, for the timer/counter clock source and direction control sig-
nals. See “Bidirectional Ports 1–4” on page 7-1 for information about configuring the port pins.
NOTE
If you use T2CLK as the timer 2 input clock, you cannot use EPA
capture/compare channel 0. If you use T2DIR as the timer 2 direction-control
source, you cannot use EPA capture/compare channel 1.
Table 10-1 on page 10-2 lists the pins associated with the EPA and the timer/counters. Pins that
are not being used for an EPA channel or timer/counter can be configured as standard I/O.
10.5.2 Programming the Timers
The control registers for the timers are T1CONTROL (Figure 10-8) and T2CONTROL (Figure
10-9). Write to these registers to configure the timers. Write to the TIMER1 and TIMER2 regis-
ters (see Table 10-2 on page 10-3 for addresses) to load a specific timer value.