8XC196NP, 80C196NU USER’S MANUAL
6-26
6.6.5 PWM Modes
The PWM toggle and PWM remap modes are designed for use with the event processor array
(EPA) to generate pulse-width modulated (PWM) output signals. These modes can also be used
with an interrupt signal from any other source. The PWM toggle mode uses a single EPA channel
to generate a PWM signal. The PWM remap mode uses two EPA channels, but it can generate
signals with duty cycles closer to 0% or 100% than are possible with the PWM toggle mode. Ta-
ble 6-7 compares the two PWM modes. For code examples, see AP-445, 8XC196KR Peripherals:
A User’s Point of View, and “EPA PWM Output Program” on page 10-26.
Figure 6-14 illustrates a generic PWM waveform. The length of an entire PWM output pulse is
T2. The time the output is “on” is T1; the time the output is “off” is T2 – T1. The formulas for
frequency and duty cycle are shown below. In most applications, the frequency is held constant
and the duty cycle is varied to change the average value of the waveform.
Frequency, in Hertz =
Duty Cycle = × 100%
Table 6-7. Comparison of PWM Modes
PWM Toggle Mode PWM Remap Mode
Uses a single EPA channel. Uses two EPA channels.
Reads the location specified by PTSPTR1
(usually EPA
x
_TIME).
Reads the location specified by PTSPTR1
(usually EPA
x
_TIME).
Adds one of two values to the location specified by
PTSPTR1. If TBIT is clear, it adds the value in
PTSCONST1. If TBIT is set, it adds the value in
PTSCONST2.
Adds the value in PTSCONST1 to the location
specified by PTSPTR1.
Stores the sum back into the location specified by
PTSPTR1.
Stores the sum back into the location specified by
PTSPTR1.
Toggles TBIT. Toggles the unused TBIT.
1
T2
-------
T1
T2
-------