A Simple Circuit For Driving Microcontroller Friendly Pwm Generator--91085A.pdf

(161 KB) Pobierz
TB085
A Simple Circuit for Driving Microcontroller
Friendly PWM Generators
Because the MCP1630 does not contain an on-chip
oscillator, its application in non-intelligent or dumb
power supply designs, is limited. However, marrying
the MCP1630 with a small pin-count microcontroller
solves the oscillator problem and opens up possibilities
for other features such as:
• Variable pulse frequency soft-start
• External shutdown control
• Under-voltage lockout
• Over temperature shutdown
Author:
Keith Curtis
Microchip Technology Inc.
INTRODUCTION
The recent interest in intelligent power supplies has
driven the development of a new class of microcontrol-
ler friendly PWM generators. These PWM generators
are the mixed signal control blocks for Switch mode
power supplies. One such device is the MCP1630. The
MCP1630 contains the 3 main elements for designing
a switching power supply as a peripheral to a microcon-
troller: a set/reset flip-flop, a high-speed voltage
comparator and an op amp to implement the error
amplifier (see Figure 1).
The microcontroller controls the MCP1630 through its
clock input. The frequency of the clock determines the
pulse frequency of the PWM output, and the duty cycle
of the clock limits the maximum PWM duty cycle of the
output. Control of the duty cycle between 0 and the
maximum set by the clock input is determined by the
current feedback to the comparator and the output of
the error amplifier (see Figure 2).
THEORY OF OPERATION
This technical brief will examine a design which
combines the PIC10F206, a 6-pin SOT-23 microcon-
troller, with the MCP1630. The power supply design
presented is a full proportional-feedback continuous
inductor current, current-mode, boost power supply
generating 15V out at .25 amps from a 9 V DC input. The
PIC10F206 generates the clock for the MCP1630 and
through that control, implements the previous list of
features.
FIGURE 1:
TYPICAL SWITCH MODE POWER SUPPLY BLOCK DIAGRAM
Vsupply
MCP1630
Flip-Flo p
R
Q
Voutput
Clock
Input
S
Q
+
Op Amp
Reference
+
Comparator
M icrocontrolle r
2004 Microchip Technology Inc.
DS91085A-page 1
784956430.431.png 784956430.442.png 784956430.453.png 784956430.464.png 784956430.001.png 784956430.012.png 784956430.023.png 784956430.034.png 784956430.044.png 784956430.055.png 784956430.066.png 784956430.077.png 784956430.088.png 784956430.099.png 784956430.110.png 784956430.121.png 784956430.132.png 784956430.143.png 784956430.153.png 784956430.164.png 784956430.175.png 784956430.186.png 784956430.197.png 784956430.208.png 784956430.219.png 784956430.230.png 784956430.241.png 784956430.252.png 784956430.263.png 784956430.274.png 784956430.285.png 784956430.296.png 784956430.307.png 784956430.318.png 784956430.329.png 784956430.340.png 784956430.351.png 784956430.362.png 784956430.373.png 784956430.384.png 784956430.394.png 784956430.405.png 784956430.415.png 784956430.420.png 784956430.421.png 784956430.422.png 784956430.423.png 784956430.424.png 784956430.425.png 784956430.426.png 784956430.427.png 784956430.428.png 784956430.429.png 784956430.430.png 784956430.432.png 784956430.433.png 784956430.434.png 784956430.435.png 784956430.436.png 784956430.437.png 784956430.438.png 784956430.439.png 784956430.440.png 784956430.441.png 784956430.443.png 784956430.444.png 784956430.445.png 784956430.446.png 784956430.447.png 784956430.448.png 784956430.449.png 784956430.450.png 784956430.451.png 784956430.452.png 784956430.454.png 784956430.455.png 784956430.456.png 784956430.457.png 784956430.458.png 784956430.459.png 784956430.460.png 784956430.461.png 784956430.462.png 784956430.463.png 784956430.465.png 784956430.466.png 784956430.467.png 784956430.468.png 784956430.469.png 784956430.470.png 784956430.471.png 784956430.472.png 784956430.473.png 784956430.474.png 784956430.002.png 784956430.003.png 784956430.004.png 784956430.005.png 784956430.006.png 784956430.007.png 784956430.008.png 784956430.009.png 784956430.010.png 784956430.011.png 784956430.013.png 784956430.014.png 784956430.015.png 784956430.016.png 784956430.017.png 784956430.018.png 784956430.019.png 784956430.020.png 784956430.021.png 784956430.022.png 784956430.024.png 784956430.025.png 784956430.026.png 784956430.027.png 784956430.028.png 784956430.029.png 784956430.030.png 784956430.031.png 784956430.032.png 784956430.033.png 784956430.035.png
 
TB085
FIGURE 2:
MCP1630 HIGH-SPEED PWM
V I N
Overtemperature
V IN
0.1 µ A
UVLO
V EXT
OSC IN
V IN
S
Q
G N D
100 k
CS
COMP
R
+
-
Q
Comp
V IN
Latch Truth Table
FB
V REF
-
+
S
R
Q
E A
2R
0
0
Qn
R
0
1
1
2.7V Clamp
1
0
0
1
1
1
HARDWARE
The temperature sensor is implemented using a digital
output device that pulls its output low when the thresh-
old temperature is exceeded. The software monitors
the input to detect an over-temperature condition and
shuts down the pulse output if the temperature goes to
high. When the temperature falls back below the
threshold temperature, the sensor output returns high
and the software soft-starts the pulse output. Hystere-
sis built in the temperature sensor prevents chattering
and the sensor’s trip temperature is preset when the
sensor is manufactured.
The shutdown input, GP1, is tied to whatever remote
start-up logic is desired. The software polls the input to
determine if a shutdown is requested and terminates
the pulse output if the input is low. Raising the input
restarts the supply.
The PIC10F206 is well suited for this function. It has an
on-chip voltage comparator for the under-voltage
detect and it has sufficient I/O to control the MCP1630
and monitor the external inputs.
The microcontroller monitors the inputs and generates
the 250 kHz clock, all in software. Because the controls
are simple, the control circuit only needs the microcon-
troller and a few components to implement all the con-
trol functions. Figure 3 shows the resulting schematic.
Microcontroller inputs are connected to a divided sup-
ply voltage, a digital temperature sensor and the shut-
down input. The remaining output is the output driving
the MCP1630 clock input.
For under-voltage detection, the divided supply voltage
is routed to the non-inverting input of the comparator.
The inverting input is tied internally to the on-chip 0.6V
reference. The software then monitors the comparator
output to detect an under-voltage condition.
DS91085A-page 2
2004 Microchip Technology Inc.
784956430.036.png 784956430.037.png 784956430.038.png 784956430.039.png 784956430.040.png 784956430.041.png 784956430.042.png 784956430.043.png 784956430.045.png 784956430.046.png 784956430.047.png 784956430.048.png 784956430.049.png 784956430.050.png 784956430.051.png 784956430.052.png 784956430.053.png 784956430.054.png 784956430.056.png 784956430.057.png 784956430.058.png 784956430.059.png 784956430.060.png 784956430.061.png 784956430.062.png 784956430.063.png 784956430.064.png 784956430.065.png 784956430.067.png 784956430.068.png 784956430.069.png 784956430.070.png 784956430.071.png 784956430.072.png 784956430.073.png 784956430.074.png 784956430.075.png 784956430.076.png 784956430.078.png 784956430.079.png 784956430.080.png 784956430.081.png 784956430.082.png 784956430.083.png 784956430.084.png 784956430.085.png 784956430.086.png 784956430.087.png 784956430.089.png 784956430.090.png 784956430.091.png 784956430.092.png 784956430.093.png 784956430.094.png 784956430.095.png 784956430.096.png 784956430.097.png 784956430.098.png 784956430.100.png 784956430.101.png 784956430.102.png 784956430.103.png 784956430.104.png 784956430.105.png 784956430.106.png 784956430.107.png 784956430.108.png 784956430.109.png 784956430.111.png 784956430.112.png 784956430.113.png 784956430.114.png 784956430.115.png 784956430.116.png 784956430.117.png 784956430.118.png 784956430.119.png 784956430.120.png 784956430.122.png 784956430.123.png 784956430.124.png 784956430.125.png 784956430.126.png 784956430.127.png 784956430.128.png 784956430.129.png 784956430.130.png 784956430.131.png 784956430.133.png 784956430.134.png 784956430.135.png 784956430.136.png 784956430.137.png 784956430.138.png 784956430.139.png 784956430.140.png 784956430.141.png 784956430.142.png 784956430.144.png 784956430.145.png 784956430.146.png 784956430.147.png
 
U5
+9V
+5V
LM3480-5
Out
In
Com
3
C5
0.1
C6
0.1
+9V
µ
F
µ
F
+C 17
C 13
+9V
+5V
L1
22
µ
F
1
µ
F
+5V
+5V
J1
R1
10K
C1
0.1
C7
0.1 µ F
µ
F
1
2
3
4
Input
J2
U1
PIC10F206
U MCP1630
1
2
3
4
5
D1
B230
7
C 14
1.0 µ F
C 15
C 16
1000 pF
R2
8.2K
V DD
3
Q1
IRLML2502
2
V DD
1
3
4
6
4
8
1
6
3
2
1.0 µ F
GP0/C+
GP1/C-
GP2/T0C KI/CO
GP3/MCLR
OSC
V REF
COMP
DRVR
CFB
VFB
1
R9
100
V SS
V SS
R3
1K
15 V DC
2
5
Output
C2
1000 pF
C 12
1500 pF
R8
0.56
R6
2.4K
220
µ
F
+5V
C3
100 p F
C10
C11
R7
R10
U4
TC6501
4
510
100K
.1
µ
F
V DD
5
3
.033 µ F
Tovr
Hyst
G ND
G ND
+5V
C8
0.1
µ
F
1
2
1
V IN
V OUT
V SS
U3
MCP1525
2
C9
1
µ
F
3
784956430.148.png 784956430.149.png 784956430.150.png 784956430.151.png 784956430.152.png 784956430.154.png 784956430.155.png 784956430.156.png 784956430.157.png 784956430.158.png 784956430.159.png 784956430.160.png 784956430.161.png 784956430.162.png 784956430.163.png 784956430.165.png 784956430.166.png 784956430.167.png 784956430.168.png 784956430.169.png 784956430.170.png 784956430.171.png 784956430.172.png 784956430.173.png 784956430.174.png 784956430.176.png 784956430.177.png 784956430.178.png 784956430.179.png 784956430.180.png 784956430.181.png 784956430.182.png 784956430.183.png 784956430.184.png 784956430.185.png 784956430.187.png 784956430.188.png 784956430.189.png 784956430.190.png 784956430.191.png 784956430.192.png 784956430.193.png 784956430.194.png 784956430.195.png 784956430.196.png 784956430.198.png 784956430.199.png 784956430.200.png 784956430.201.png 784956430.202.png 784956430.203.png 784956430.204.png 784956430.205.png 784956430.206.png 784956430.207.png 784956430.209.png 784956430.210.png 784956430.211.png 784956430.212.png 784956430.213.png 784956430.214.png 784956430.215.png 784956430.216.png 784956430.217.png 784956430.218.png 784956430.220.png 784956430.221.png 784956430.222.png 784956430.223.png 784956430.224.png 784956430.225.png 784956430.226.png 784956430.227.png 784956430.228.png 784956430.229.png 784956430.231.png 784956430.232.png 784956430.233.png 784956430.234.png 784956430.235.png 784956430.236.png 784956430.237.png 784956430.238.png 784956430.239.png 784956430.240.png 784956430.242.png 784956430.243.png 784956430.244.png 784956430.245.png 784956430.246.png 784956430.247.png 784956430.248.png 784956430.249.png 784956430.250.png 784956430.251.png 784956430.253.png 784956430.254.png 784956430.255.png 784956430.256.png 784956430.257.png 784956430.258.png 784956430.259.png 784956430.260.png 784956430.261.png 784956430.262.png 784956430.264.png 784956430.265.png 784956430.266.png 784956430.267.png 784956430.268.png 784956430.269.png 784956430.270.png 784956430.271.png 784956430.272.png 784956430.273.png 784956430.275.png 784956430.276.png 784956430.277.png 784956430.278.png 784956430.279.png 784956430.280.png 784956430.281.png 784956430.282.png 784956430.283.png 784956430.284.png 784956430.286.png 784956430.287.png 784956430.288.png 784956430.289.png 784956430.290.png 784956430.291.png 784956430.292.png 784956430.293.png 784956430.294.png 784956430.295.png 784956430.297.png 784956430.298.png 784956430.299.png 784956430.300.png 784956430.301.png 784956430.302.png 784956430.303.png 784956430.304.png 784956430.305.png 784956430.306.png 784956430.308.png 784956430.309.png 784956430.310.png 784956430.311.png 784956430.312.png 784956430.313.png 784956430.314.png 784956430.315.png 784956430.316.png 784956430.317.png 784956430.319.png 784956430.320.png 784956430.321.png 784956430.322.png 784956430.323.png 784956430.324.png 784956430.325.png 784956430.326.png 784956430.327.png 784956430.328.png 784956430.330.png 784956430.331.png 784956430.332.png 784956430.333.png 784956430.334.png 784956430.335.png 784956430.336.png 784956430.337.png 784956430.338.png 784956430.339.png 784956430.341.png 784956430.342.png 784956430.343.png 784956430.344.png 784956430.345.png 784956430.346.png 784956430.347.png 784956430.348.png 784956430.349.png 784956430.350.png 784956430.352.png 784956430.353.png 784956430.354.png 784956430.355.png 784956430.356.png 784956430.357.png 784956430.358.png 784956430.359.png 784956430.360.png 784956430.361.png 784956430.363.png 784956430.364.png 784956430.365.png 784956430.366.png 784956430.367.png 784956430.368.png 784956430.369.png 784956430.370.png 784956430.371.png 784956430.372.png 784956430.374.png 784956430.375.png 784956430.376.png 784956430.377.png 784956430.378.png 784956430.379.png 784956430.380.png 784956430.381.png 784956430.382.png 784956430.383.png 784956430.385.png 784956430.386.png 784956430.387.png 784956430.388.png 784956430.389.png 784956430.390.png
 
TB085
SOFTWARE
FIGURE 6:
CODE LISTING 2
Soft_Start
MOVLW
The software monitors the inputs and generates the
output pulse using a simple bit-set/bit-clear loop,
expanded to interleave all the input testing. By keeping
the bit-set to bit-set time to 4 cycles, the output duty
cycle is locked to 25% for a 250 kHz clock. The latency
time for a shutdown is 16 cycles. Figure 4 shows the
code listing.
.32
;table of 32
MOVWF
counter
MOVLW
Last-Table
;set to last
MOVWF
pointer
Loop
MOVF
counter,w
;reload delay
MOVWF
count
Delay
;generate delay
NOP
DECFSZ count,f
FIGURE 4:
CODE LISTING 1
;decrement count
loop
BSF
GOTO
Delay
;repeat til done
PWM
MOVF
pointer,w
;get pntr 4 jump
BCF
PWM
;generate a pulse
ADDWF
PCL,f
;jump
BTFSS
CMPOUT
;test 4 low Vin
Table
BSF PWM
BCF PWM ;32 pulse
GOTO $+1 ;2 cycle delay
|-----------;29 copies of pulse + delay
BSF
GOTO
Low_volt
;if low shutdown
BSF
PWM
BCF
PWM
;generate a pulse
BTFSS
GP1
;test 4 hi temp
GOTO
High_temmp ;if hi shutdown
PWM
BSF
PWM
BCF
PWM
;2nd pulse
BCF
PWM
;generate a pulse
GOTO
$+1
BTFSS
GP3
;test 4 shutdown
Last
BSF
GOTO
shtdwn
;if shutdown
PWM
BSF
PWM
BCF
PWM
BCF
PWM
;generate a pulse
GOTO
$+1
GOTO
loop
;infinate loop
DECF
pointer,f
;add a pulse
DECF pointer,f
DECF pointer,f
DECFSZ counter,f
The soft-start function is generated by ramping up the
number of output pulses. At start-up, a single pulse is
followed by a long delay. Next, 2 pulses are followed by
a shorter delay, then 3, 4 and so on until the pulse chain
is continuous.
The soft-start code is implemented as a table of bit-set/
bit-clear/delay instructions, similar to code listing 1 with
a delay and control section. Figure 5 shows the timing
of soft-start and Figure 6 is an excerpt from the actual
code.
;decrease delay
GOTO
Loop
;if 10, continue
loop_forever
;if 0, goto main
CONCLUSION
Using a combination of software and simple hardware,
an efficient control for a PWM generator is imple-
mented with many of the features found in more com-
plex controllers. The result is a modular building-block
style design with many advanced features that can be
easily customized for a customer’s needs.
FIGURE 5:
PWM CLOCK
PWM Clock
TABLE 1:
MEMORY USAGE
GPR
3 bytes
Program
153 words
2004 Microchip Technology Inc.
DS91085A-page 4
784956430.391.png 784956430.392.png 784956430.393.png 784956430.395.png 784956430.396.png 784956430.397.png 784956430.398.png 784956430.399.png 784956430.400.png 784956430.401.png 784956430.402.png 784956430.403.png 784956430.404.png 784956430.406.png 784956430.407.png 784956430.408.png 784956430.409.png 784956430.410.png 784956430.411.png 784956430.412.png 784956430.413.png 784956430.414.png
 
Note the following details of the code protection feature on Microchip devices:
Microchip products meet the specification contained in their particular Microchip Data Sheet.
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR WAR-
RANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED,
WRITTEN OR ORAL, STATUTORY OR OTHERWISE,
RELATED TO THE INFORMATION, INCLUDING BUT NOT
LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE,
MERCHANTABILITY OR FITNESS FOR PURPOSE .
Microchip disclaims all liability arising from this information and
its use. Use of Microchip’s products as critical components in
life support systems is not authorized except with express
written approval by Microchip. No licenses are conveyed,
implicitly or otherwise, under any Microchip intellectual property
rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, K EE L OQ , micro ID , MPLAB, PIC, PICmicro, PICSTART,
PRO MATE, PowerSmart, rfPIC, and SmartShunt are
registered trademarks of Microchip Technology Incorporated
in the U.S.A. and other countries.
AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB,
PICMASTER, SEEVAL, SmartSensor and The Embedded
Control Solutions Company are registered trademarks of
Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, dsPICDEM,
dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR,
FanSense, FlexROM, fuzzyLAB, In-Circuit Serial
Programming, ICSP, ICEPIC, MPASM, MPLIB, MPLINK,
MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail,
PowerCal, PowerInfo, PowerMate, PowerTool, rfLAB,
rfPICDEM, Select Mode, Smart Serial, SmartTel and Total
Endurance are trademarks of Microchip Technology
Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
© 2004, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received ISO/TS-16949:2002 quality system certification for
its worldwide headquarters, design and wafer fabrication facilities in
Chandler and Tempe, Arizona and Mountain View, California in
October 2003. The Company’s quality system processes and
procedures are for its PICmicro ® 8-bit MCUs, K EE L OQ ® code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
2004 Microchip Technology Inc.
DS91085A-page 5
784956430.416.png 784956430.417.png 784956430.418.png 784956430.419.png
 
Zgłoś jeśli naruszono regulamin