Microchip Technology MCP1631RD-MCC2 Data Sheet
Software
© 2009 Microchip Technology Inc.
DS51791A-page 39
C.5
MPLAB
®
AND PICKIT™ 2 DEBUGGING EXERCISE
1. Startup MPLAB (not supplied, available at: http://www.microchip.com).
2. From the toolbar, select “File | Open Workspace”.
3. Browse to the evaluation board source code path.
4. Select the existing workspace file named
2. From the toolbar, select “File | Open Workspace”.
3. Browse to the evaluation board source code path.
4. Select the existing workspace file named
“MCP1631HVBuckBoostBatteryChargerReferenceDesign.mcw”
or create a new one.
5. Connect the PICkit 2 programmer to header J3 on the battery charger board.
Align Pin 1 of the header with the Pin 1 mark on the programmer.
6. Set the bench power supply voltage control to minimum voltage output.
7. Turn on the power supply and set the output voltage to 8V. Turn off the power
7. Turn on the power supply and set the output voltage to 8V. Turn off the power
supply.
8. Connect the bench power supply to the battery charger board. Connect +V(8V)
to J1-1 and –V (Ground) to J1-2.
9. Turn on the power supply.
10. From the toolbar, select “Debugger | Connect”. The debugger should find the
10. From the toolbar, select “Debugger | Connect”. The debugger should find the
PIC16F883 processor.
11. From the toolbar, select “File | Import”.
12. Browse to the source code path.
13. Select the existing project file named
12. Browse to the source code path.
13. Select the existing project file named
“MCP1631HVBuckBoostBatteryChargerReferenceDesign.hex”.
14. From the toolbar, select “Debugger | Program”. The debugger will program the
PIC16F883 with the imported hex file.
15. From the toolbar, select “Debugger | Reset | Processor Reset”. This must always
be done after programming.
16. From the toolbar, select “File | Open”.
17. In the “Files of type” text box, select “List Files (*.lst)”.
18. Click on “MCP1631HVBuckBoostBatteryChargerReferenceDesign.lst”.
19. Click on “Open”. This opens the mikroC
17. In the “Files of type” text box, select “List Files (*.lst)”.
18. Click on “MCP1631HVBuckBoostBatteryChargerReferenceDesign.lst”.
19. Click on “Open”. This opens the mikroC
™
listing file for the project. Variable and
Code addresses are at the end.
20. Scroll to the end of the listing file and locate the code label “L_main_1:”. Write
down the function address.
21. In the “Program Memory” window, scroll down until you reach the same address
as the “L_main_1:” function address. Right click on the line and set a breakpoint.
22. From the toolbar, select “Debugger | Run”. The debugger will stop at the
breakpoint. Disable the breakpoint.
23. From the toolbar, select “Debugger | Run”. The debugger will continue.
When debugging the battery charger board, be careful when setting breakpoints. If the
breakpoint occurs while the Voltage Reference PWM is HIGH, the V
When debugging the battery charger board, be careful when setting breakpoints. If the
breakpoint occurs while the Voltage Reference PWM is HIGH, the V
REF
voltage will rise
to about 2.5V. The MCP1631HV will then attempt to supply the current for the given
V
V
REF
, which will be high (about 2.5V / 1.1 = 2.27A). The current is limited by the V
REF
signal which is in turn limited by the V
REF
voltage divider resistor pair R24 and R34.