Pwm Toggle Mode Example - Intel 8XC196K Series User Manual

Table of Contents

Advertisement

8XC196K x , J x , CA USER'S MANUAL
Figure 5-15 illustrates a generic PWM waveform. 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 val-
ue of the waveform.
Frequency, in Hertz =
T1
× 100%
------ -
Duty Cycle =
T2
Output Value
1
on
0
0
T1
On-time = T1
The PWM modes do not use a PTSCOUNT register to specify the number of consecutive PTS
cycles. To stop producing the PWM output, clear the PTSSEL.x bit to disable PTS service for the
interrupt and reconfigure the EPA channel in the interrupt service routine.
5.6.6.1

PWM Toggle Mode Example

Figure 5-16 shows the PTS control block for PWM toggle mode. To generate a PWM waveform
using PWM toggle mode and EPA0, complete the following procedure. This example uses the
values stored in CSTORE1 and CSTORE2 to control the frequency and duty cycle of a PWM.
1.
Disable the interrupts and the PTS. The DI instruction disables all standard interrupts; the
DPTS instruction disables the PTS.
2.
Store the on-time (T1) in CSTORE1.
3.
Store the off-time (T2 – T1) in CSTORE2.
5-32
1
------ -
T2
off
Off-time = T2 - T1
Figure 5-15. A Generic PWM Waveform
on
T2
T2 + T1
off
Time, t
A0263-02

Advertisement

Table of Contents
loading

Table of Contents