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 Digit al Millennium Copyright Act. If suc h a c t s
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 WARRANTIES 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 M icrochip’s prod ucts 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
EELOQ, microID, 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, Linear Active Thermistor,
MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM,
PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo,
PowerMate, PowerTool, rfLAB, rfPICD EM, Select Mode,
Smart Serial, SmartTel, Total Endurance and WiperLock 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.
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
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.
All documentation becomes dated, and this manual is no exception. Microchip tools and
documentation are constantly evolving to meet customer needs, so some actual dialogs
and/or tool descriptions may differ from those in this document. Please refer to our web site
(www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each
page, in front of the page number. The numbering convention for the DS number is
“DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the
document.
For the most up-to-date information on development tools, see the MPLAB
Select the Help menu, and then Topics to open a list of available on-line help files.
®
IDE on-line help.
INTRODUCTION
This chapter contains general information that will be useful to know before using the
MCP1252 Charge Pump Backlight LED Demo Board. Items discussed in this chapter
include:
• Document Layout
• Conventions Used in this Guide
• Recommended Reading
• The Microchip Web Site
• Customer Support
• Document Revision History
DOCUMENT LAYOUT
This document describes how to use the MCP1252 Charge Pump Backlight LED Demo
Board. The manual layout is as follows:
• Chapter 1. “Product Overview” – Important information about the MCP1252
Charge Pump Backlight LED Demo Board.
• Chapter 2. “Installation and Operation” – Includes instructions on how to get
started with this user’s guide and a description of the user’s guide.
• Appendix A. “Schematic and Layouts” – Shows the schematic and layout
diagrams for the MCP1252 Charge Pump Backlight LED Demo Board.
• Appendix B. “Bill-Of-Materials (BOM)” – Lists the parts used to build the
MCP1252 Charge Pump Backlight LED Demo Board.
• Appendix C. “00016R1.asm Source Code” – Provides information about the
application firmware and where the sou rce co de can be found.
Choice of mutually exclusive
arguments; an OR selection
Represents code supplied by
user
“Save project before build”
‘b00100, ‘b10
any valid filename
0xFFFF, 0x007A
[options]
errorlevel {0|1}
var_name...]
void main (void)
{ ...
}
®
IDE User’s Guide
RECOMMENDED READING
This user's guide describes how to use MCP1252 Charge Pump Backlight LED Demo
Board. The following Microchip documents are available and recommended as
supplemental reference resources.
MCP1252/3 Data Sheet, “Low Noise, Positive Regulated Charge Pump”,
(DS21752)
This data sheet provides detailed information regarding the MCP1252/3 product family.
Microchip provides online support via our web site at www.microchip.com. This web
site is used as a means to make files and information easily available to customers.
Accessible by using your favorite Internet browser, the web site contains the following
information:
• Product Support – Data sheets and errata, application notes and sample
programs, design resources, user’s guides and hardware support documents,
latest software releases and archived software
• General Technical Support – Frequently Asked Questions (FAQs), technical
support requests, online discussion groups, Microchip consultant program
member listing
• Business of Microchip – Product selector and ordering guides, latest Microchip
press releases, listing of seminars and events, listings of Microchip sales offices,
distributors and factory representatives
CUSTOMER SUPPORT
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
• Development Systems Information Line
Customers should contact their distributor, representative or field application engineer
(FAE) for support. Local sales offices are also available to help customers. A listing of
sales offices and locations is included in the back of this document.
Technical support is available through the web site at: http://support.microchip.com
In addition, there is a Development Systems Information Line which lists the latest
versions of Microchip's development systems software products. This line also provides information on how customers can receive currently available upgrade kits.
The Development Systems Information Line numbers are:
1-800-755-2345 – United States and most of Canada
1-480-792-7302 – Other Interna tio nal Loca tio ns
Today’s new color displays require a pure white light for backlighting. White
light-emmitting diodes have become the component of choice. The MCP1252-ADJ is
an excellent choice for biasing the backlighting or driving other LED applications. Light
intensity is controlled uniformly through the use of ballast resistors. The peak intensity
is set by the feedback (FB) to the the MCP1252-ADJ. Dimming is accomplished by
pulse-width modulating the shutdown pin of the device.
This chapter covers the following topics:
• What is the MCP1252 Charge Pump Backlight LED Demo Board?
• What the MCP1252 Charge Pump Backlight LED Demo Board Kit Includes
MCP1252 CHARGE PUMP BACKLIGHT
LED DEMO BOARD USER’S GUIDE
3 AAA
Battery
Pack
Power
Supply
FIGURE 1-1:MCP1252 Charge Pump Backlight LED Demo Board Block
Diagram.
MCP1252 Charge Pump Backlight LED Demo Board User’s Guide
1.2WHAT IS THE MCP1252 CHARGE PUMP BACKLIGHT LED DEMO BOARD?
The MCP1252 Charge Pump Backlight LED Demo Board demonstrates the use of a
charge pump device in a LED application. The board also serves as a platform to
evaluate the MCP1252 device generally.
The MCP1252-ADJ device used in this application is an in ductorless, positive-regulated
charge pump DC/DC converter . The device generates an adjustable output volt age. It
is specifically designed for applications requiring low noise and high efficiency, and is
able to deliver up to 120 mA output current. In addition, a charge pump is a low-cost,
compact and simple solution for an application, as it o nly requires one external capacitor
to transfer charge from the input supply to the regulated output.
The MCP1252 allows the input voltage to be lower or higher than the the output voltage
by automatically switching between buck and boost operation. This makes it especially
suited for battery applications, allowing the system voltage to be maintained even after
the batteries have discharged below the system voltage level, further extending the
overall charge life of the battery.
1.3WHAT THE MCP1252 CHARGE PUMP BACKLIGHT LED DEM O BOARD KIT
INCLUDES
This MCP1252 Charge Pump Backlight LED Demo Board kit includes:
• MCP1252 Charge Pump Backlight LED Demo Board (102-00016)
The MCP1252 Charge Pump Backlight LED Demo Board uses the MCP1252-ADJ to
power four white LEDs. A PIC10F206 microcontroller in a SOT23 package is used to
provide an enable signal to the MCP1252. It also accepts a push button input that
allows the user to adjust the white LEDs to five different light intensities, in addition to
placing the system in a standby mode that consumes less than 1 µA of current (typ.).
The PIC10F206 microcontroller is programmable, allowing the user to modify or
develop their own firmware routines to further evaluate the MCP1252 in this
application.
2.2FEATURES
The MCP1252 Charge Pump Backlight LED Demo Board has the following features:
• Programmed MCP1252 charge pump control (via the PIC10F206)
• Four white LEDs
• PIC10F206 microcontroller
- Enables the MCP1252 charge pump
- Controls light intensity
- Places system into Sleep mode (< 1 µA)
• Push button interface for multiple control options
• Baseline Flash Microcontroller Programmer (BFMP) Header for reprogramming
the PIC10F206
MCP1252 Charge Pump Backlight LED Demo Board User’s Guide
f”
f”
2.3GETTING STARTED
The MCP1252 Charge Pump Backlight LED Demo Board comes fully assembled and
tested. The board requires 3 AAA batteries as a power source for the application.
2.3.1Powering the MCP1252 Charge Pump Backlight LED Demo
Board
Insert three AAA batteries into the battery pack on the bottom of the board. As soon as
the system powers up, the internal program of the PIC10F206 will initialize and remain
in a low-power sleep mode (<1 µA) until the S1 button is pressed by the user.
The MCP1252 Charge Pump Backlight LED Demo Board does not need a power
switch or power jumper because of the “standby” or “sleep” mode of the PIC10F206
microcontroller. Upon entering Sleep mode, the system requires less than 1 µA (typ) of
current. So, with three AAA batteries used in the application (at 1250 mAh per battery),
the system’s power requirements in Sleep mode are minimal (the “shelf life” of an alkaline battery is 5-7 years, whereas the system current load in Sleep mode would
discharge the battery pack in about 400 years!).
Activating Application and Changing the LED intensity
1. To activate the LEDs, simply press the S1 push button. The LEDs will turn on at
a low intensity level when the push button is pressed, gaining intensity when the
push button is pressed again. There are 5 levels of LED intensity (plus the “off”
state).
The intensity of the LEDs are controlled via the SHDN
A Pulse-Width Modulated (PWM) signal is generated by the PIC10F206 and routed
to the SHDN
duty cycle of the PWM waveform is varied, such that narrow pulses create a
low-intensity conditi on, whi le wide r pulse s cr ea te a high- in tens it y con dit ion.
2. The LEDs will be turned off, and the system will enter Sleep mode, when the
LEDs are in the high-intensity state and the push button is pressed. Subsequent
push button presses will cycle the LEDs as described in Step 1.
input pin of the MCP1252. The MCP1252 is actually pulsed, and the
Evaluating the Application
The best way to evaluate the MCP1252 Charge Pump Backlight LED Demo Board is
to dig into the circuit. Measure voltages and currents with a DVM and probe the board
with an oscilloscope. Test points have been provided to simplify this task. The test
points correspond to the pins of the MCP1252: PGD (= PGOOD), Vout, V
GND, SHDN
The firmware program in the PIC10F206 can also be edited to modify the operation of
the application. For example, the output signal that is routed from GP0 of the
PIC10F206 to SHDN
intensities, slowly blinking the LEDs on/off or provide some other pattern. There is also
an optional push button (S2) that can be used to provide additional control options to
the system
and FB.
of the MCP1252 can be changed to implement different light
input pin of the MCP1252.
(= VIN),
DD
Firmware
The PIC10F206 comes preprogrammed with firmware to operate the system as
described above. The program file can be found on the CD that comes with the kit. The
file listing and firmware flow diagram are shown in Appendix C. “00016R1.asm Source Code”.
The program is fairly simple and straightforward. There is an initialization routine at the
beginning of the program. The constants allow for five LED intensity levels to be
adjusted to the appropriate light intensity (LED_HI_ON, LED_MEDHI_ON, etc.), set the
PWM period (PERIOD) and maximum time (MAX_TIME) before the unit switches back
to Sleep mode. The variables track what mode the unit is in (MODE), implement
counters (COUNTER, TIMERH, TIMERL), etc.
Upon resetting the processor, the ports are initialized and registers are configured in
the INIT_PORTS routine. If the device has come out of Sleep mode, the MODE variable
is set so the LEDs will be at low intensity. The OPTION register is configured to
wake-up on Port pin change. The GPIO port is configured to set GP0 (PWM to the
MCP1252) as an output and GP1, GP2 and GP3 (push button) as inputs. The
processor will reset on power-up or due to a wake-up from Sleep mode. Therefore, the
ST ATUS register needs to be tested to determine the source of the reset. If the reset
occurred due to powering up the system for the first time, the program proceeds to the
INIT_VARS subroutine, where the program variables are initialized. If the reset
occurred due to a wake-up from Sleep mode, the program proceeds to the WAKE
subroutine.
MCP1252 Charge Pump Backlight LED Demo Board User’s Guide
The WAKE routine tests the GPIO push button input to determine if the button has been
pressed. If it has, the program goes to the INC_MODE subroutine to set the new LED
intensity mode. The INC_MODE and MODE_SELECT routines determine the appropriate
light intensity when the device is reset, comes out of Sleep mode, or button S1 is
pressed to increment the light intensity. The LED_FULL, LED_HIGH, LED_MEDHI, LED_MED, LED_LOW, and LED_OFF routines set one of six LED settings (five light
intensity settings and “off”).
Programming
Header JP1 is provided for in-system circuit programming. This is an optional feature
since the demo board comes pre-programmed with F/W to operate the system. The
PIC10F206 can be reprogrammed with the Baseline Flash Microcontroller Programmer
(BFMP).
The BFMP is a simple and easy-to-use in-circuit serial programmer intended to be used
with any of Microchip’s new baseline Flash PIC
PIC10F200/202/204/206, PIC12F508/509, PIC16F505 and PIC16F54/57/59. The
BFMP provides a 6-pin linear In-Circuit Serial Programming™ (ICSP™) header for
standard ICSP support, as well as stand-alone programming support for the PIC10F
family when paired with the PIC10F2XX programmer adapter, providing the least
expensive method of programming. The BFMP utilizes USB and does not require an
external power supply. The included Graphical User Interface (GUI) allows you to read,
write and verify the microcontroller to be programmed.
Please refer to Microchip’s web site (www.microchip.com) for additional information on
the BFMP.
Software License Agreement
The software supplied herewith by Microchip Technology Incorporated (the “Company”) is intended
and supplied to you, the Company’s customer, for use solely and exclusively with products manufactured by the Company.
The software is owned by the Company and/or its supplier, and is protected under applicable copyright laws. All rights are reserved. Any use in violation of the foregoing restrictions may subject
the user to criminal sanctions under applicable laws, as well as to civil liability for the breach
of the terms and conditions of this license.
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR
STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE
FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
; ‘__CONFIG’ directive is used to embed configuration data within .asm file.
; The labels following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
;constants
;increase led_xxx_on to increase intensity ( value must be less than period value)
;increase period to reduce PWM frequency and increase PWM resolution
led_hi_on = 0x16 ;on loops for high brightness mode
led_hi_off = 0x11 ;off loops for high brightness mode, value will be calculated
by the program (10)
led_medhi_on = 0x08 ;on loops for medium_high brightness mode
led_medhi_off = 0x11 ;off loops for high brightness mode (11)
led_med_on = 0x06 ;on loops for medium brightness mode
led_med_off = 0x11 ;off loops for high brightness mode (11)
led_low_on = 0x05 ;on loops for low brightness mode
led_low_off = 0x12 ;off loops for high brightness mode (12)
period = 0x0E ;total loops per PWM period
max_time = 0xff ;on time before unit swithces back to sleep
;variables
mode = 0x13 ;current mode ( high, med, lo )
counter = 0x14 ;hi and low time counter
debounce = 0x15 ;debounce counter
flag = 0x16 ;debounce control flags
;bits used in the flag variable
new_mode = 7 ;when set a debounced user keypress has been detected
timer_ena = 6 ;when clear the debounce timer will not increment
;GPIO pins
button = 3 ;mode select button
pwm = 0 ;pwm output
reset nop
nop
bcf OSCCAL, FOSC4 ; GP2/T0CKI/COUT applied to GP2 pin
init_ports movlw 0x01 ;initalize mode, upon wake up led will be at low intensity
movwf mode
;
movlw b’00001111’ ;configure for wake on port change
OPTION
;
movlw b’01010011’ ;disable the comparator
movwf 0x07 ;write to CMCON0
;
clrf GPIO
movlw 0x0E
tris GPIO ;configure port
;
bcf STATUS, GPWUF
btfsc STATUS, CWUF ;test for wake up or reset
goto wake
btfsc STATUS, GPWUF
goto wake
btfss STATUS, TO
goto wake
btfss STATUS, PD
goto wake
goto init_vars ;initialize vars
init_vars movlw 0xFF
movwf timerh
movwf timerl
;
movlw led_hi_on ;calculate off times based on time remaining in
PWM period
movwf led_hi_off ;add the complement of on time to the window time
comf led_hi_off, f
movlw period
addwf led_hi_off, f
;
movlw led_medhi_on ;calculate off times based on time remaining in
PWM period
movwf led_medhi_off ;add the complement of on time to the window
time
comf led_medhi_off, f
movlw period
addwf led_medhi_off, f
;
movlw led_med_on ;calculate off times based on time remaining in
PWM period
movwf led_med_off ;add the complement of on time to the window time
comf led_med_off, f
movlw period
addwf led_med_off, f
;
movlw led_low_on ;calculate off times based on time remaining in
PWM period
movwf led_low_off ;add the complement of on time to the window time
comf led_low_off, f
movlw period
addwf led_low_off, f
;
movf GPIO, w ;read port before entering sleep mode
sleep
wake btfss GPIO, button ;only allow a low to bring PIC out of sleep
goto inc_mode
movlw 0x20
call delay
movf GPIO, w
sleep
;
inc_mode incf mode, f ;it was a pin change, determine new mode
;determine current mode
mode_select bcf flag, new_mode ;clear new mode flag
;
movlw 0x01
subwf mode, w
btfsc STATUS, Z
goto led_off
;
movlw 0x02
subwf mode, w
btfsc STATUS, Z
goto led_low
;
movlw 0x03
subwf mode, w
btfsc STATUS, Z
goto led_med
;
;high brightness routine
led_high bsf GPIO, pwm ;turn on LED(s) for a set time
movlw led_hi_on
call delay
bcf GPIO, pwm ;turn off LED(s) fo a set time
movf led_hi_off, w
call delay
call bounce
btfss flag, new_mode
goto led_high
goto mode_select
;medium-high brightness routine
led_medhi bsf GPIO, pwm ;turn on LED(s) for a set time
movlw led_medhi_on
call delay
bcf GPIO, pwm ;turn off LED(s) fo a set time
movf led_medhi_off, w
call delay
call bounce
btfss flag, new_mode
goto led_medhi
goto mode_select
;medium brightness routine
led_med bsf GPIO, pwm ;turn on LED(s) for a set time
movlw led_med_on
call delay
bcf GPIO, pwm ;turn off LED(s) fo a set time
movf led_med_off, w
call delay
call bounce
btfss flag, new_mode
goto led_med
goto mode_select
;low brightness routine
led_low bsf GPIO, pwm ;turn on LED(s) for a set time
movlw led_low_on
call delay
bcf GPIO, pwm ;turn off LED(s) for a set time
movf led_low_off, w
call delay
call bounce
btfss flag, new_mode
goto led_low
goto mode_select
;led off
led_off movlw 0x20
call delay
bcf GPIO, pwm ;turn off LED(s)
movf GPIO, w ;read port before entering sleep mode
sleep
;delay loop for on and off time
delay movwf counter ; Delay = (3 + (3 * counter) + 2) Tcy
loop decfsz counter, f
goto loop
retlw 0x00
;check for button press
bounce btfss GPIO, button ; Is Button Depressed?
goto bounce1 ; Yes, go to “bounce1”
bsf flag, timer_ena ; No, allow timer to start
clrf debounce ; no user entry, reset debounce timer
retlw 0x00 ;
bounce1 btfss flag, timer_ena
retlw 0x00 ;do not increment as we have not seen the debounce
released yet
incfsz debounce, f ;inc debounce timer
retlw 0x00 ;not yet
bsf flag, new_mode
incf mode, f ;a valid press has been detected
bcf flag, timer_ena ;prevent timer from incrementing to prevent
cycling though modes by holding debounce
bounce00 retlw 0x00