MICROPROCESSOR FREQ
CCPR1L:CCP1CON(4: 5)
TIMER PRESCALER
PR2 VALUE
PWM FREQUENCY (Hz)
PWM PERIOD (μs)
PWM ON TIME (μs)
512
512
256
128
64
72
4
1
1
1
1
16
128
128
128
128
128
23
23256
93023
93023
93023
93023
31250
43.0
10. 8
10. 8
10. 8
10. 8
32.0
42. 7
10. 7
5. 3
2.7
1.3
24.0
Figure 4. For the
PIC182455 microprocessor, the PWM output is
on Pin 13 (RC2). PWM
can be described by the
two parameters: period
and duty cycle. The
period and ON time are
controlled by loading certain values into registers
on the microprocessor.
The period is set by using
the following equation:
product of PR2 and TMR2 increases
the PWM period. Increasing
the contents of CCPR1L and
CCP1CON increases the ON time.
One common application of
PWM signals is motor control. By varying the ON time of a PWM signal sent
to a motor, you can vary the effective
power of the signal and thereby slow the
motor down or speed it up. We will use
the PWM signal to control the voltage
output of the boost power supply.
Circuit Design
In order to build the circuit, there
are a number of interacting variables
that need to be optimized to
determine the final output voltage and
the response to the requested voltage.
Some of these variables are:
PWM Period = (PR2+1)
* 4 * Tosc *TMR2
[Equation 4]
perfect inductor. One can use the
spreadsheet to see the effects of
inductor value, ON time, voltage
ripple, and load on the peak current,
output voltage, and output capacitor.
Also shown in Figure 5 are
two limiting conditions. First, if the
ON time and inductor combination
Here, PR2 is the TIMER2 period register, and TMR2 is the TIMER2 prescaler
register. Tosc is the period of the system
clock, that is, (clock rate)-1. For example,
for a 48 MHz clock rate, Tosc would be
1/48 (= 0.0208) microseconds.
The ON time is calculated from
the following equation:
1. Value of L1 inductor (inductor rated
at peak current)
2. Value of C1 capacitor (capacitor
rated at peak voltage)
3. PWM period
4. PWM ON time
5. Values of R3 and R4 to limit A/D
value to 0-5 volts
A boost converter can have as few as four
basic components: a semiconductor switch,
a diode, an inductor, and a capacitor.
are too large, the power supply will
cease to operate in DCM and will start
operating in CCM. Second, if the
inductor value is too small, the peak
current will exceed the limiting
current of one of the components.
PWM ON Time = (CCPR1L:
CCP1CON<5: 4>) * Tosc *TMR2
[Equation 5]
An Introduction to
Pulse Width Modulation
Most Microchip microprocessors
have a PWM feature. PWM is a
process by which the ON portion of a
square wave is varied as shown in
74 September 2006
where CCPR1L:CCP1CON<5: 4> is a
10-bit number consisting of the
contents of the CPR1L register and bits
5 and 4 of the CCP1CON register.
If the ON time is longer than the
PWM period, the CCP2 output pin
will never be cleared. Table 2 shows
the behavior of the PWM period and
ON time for various register values.
This table shows that increasing the
Because of the number of interacting values, I decided to use the computer program SPICE to analyze the circuit before building it on a breadboard.
SPICE stands for Simulation Program
with Integrated Circuit Emphasis.
SPICE is a general-purpose circuit
simulation program developed at the
University of California, Berkley for
nonlinear DC, nonlinear transient,
and linear AC analyses. Circuits may
contain resistors, capacitors, inductors,
independent voltage and current
sources, and the five most common
semiconductor devices: diodes, BJTs,
JFETs, MESFETs, and MOSFETs.
I had not used SPICE before, but
there was an excellent article in the July
‘02 issue of Nuts & Volts [Reference 3].
The LTSPICE program mentioned in the
article is available as a free download at
Reference 4. The LTSPICE program now
includes the SWITCHERCAD III graphical user interface that allows one to
draw a schematic and analyze it with
LTSPICE without ever having to enter a