background image

MPLAB Starter Kit for PIC18F User’s Guide

DS51852A-page 34

 

©

 2009 Microchip Technology Inc.

B.2

PIC18F SOFT START CIRCUITRY

One strategy to meet the key USB current specifications is to include a software 
controllable soft start mechanism. The starter kit implements the simple soft start circuit 
shown in Figure B-1.

FIGURE B-1:

PIC18F STARTER KIT SOFT START CIRCUIT

Transistor, Q1, a power MOSFET, blocks the current from the 3.3V power rail to the 
non-microcontroller portions of the application circuit (e.g., SD card, OLED, etc). R21 
ensures that on initial power-up, Q1 is blocking the current flow. R20 and C16 form an 
RC filter on the digital output from the microcontroller (RC0 port). This RC filter creates 
an analog voltage on the gate of Q1 from the PWM signal supplied by the micro-
controller. The values of C16 and R20 are chosen to produce a large RC time constant 
compared to the PWM frequency, and such that, the current drawn from the pin is within 
the port pin’s specification.

The PWM frequency is based on the RC network and is chosen to produce a fairly 
constant voltage on the gate of Q1. The PWM duty cycle is determined by the gate 
threshold of Q1. Once the frequency is selected, changing the PWM duty cycle will 
result in a change of the gate voltage. The duty cycle is set so that the starting voltage 
on the gate of Q1 is above the threshold voltage across all device variations, so that 
the device is in an OFF state. The duty cycle is varied at a rate in which the gate voltage 
on Q1 changes slowly enough to ensure that the transistor stays in its linear region dur-
ing the full charging of Q1’s output (Figure B-2). The result is that voltage is supplied to 
the application at a slower rate, thus lowering the inrush current.

The duty cycle should stop sweeping at a point that is lower than any possible value for 
Q1’s threshold voltage; this ensures that the entire linear region is used for as long as 
possible. Once this point is reached, the software can disable the PWM and set the 
output of RC0 low; this puts Q1 in Full Saturation mode.

Figure B-2 and Figure B-3 show how the change in gate voltage (yellow trace) relates 
to the change in the circuit’s output (blue trace). Figure B-2 captures a close look at the 
linear region, while Figure B-3 captures the entire PWM cycle from no output to full out-
put. Note that the gate voltage decreases slowly and constantly over the entire potential 
threshold voltage range of Q1.

IRLML6402PBF

Q1

+3.3V

R20
1.5k

R21
100k

C16
0.1 

μ

F

APP_VDD

RC0

           

Summary of Contents for MPLAB

Page 1: ...2009 Microchip Technology Inc DS51852A MPLAB Starter Kit for PIC18F User s Guide...

Page 2: ...ochip Technology Incorporated in the U S A All other trademarks mentioned herein are property of their respective companies 2009 Microchip Technology Incorporated Printed in the U S A All Rights Reser...

Page 3: ...le Application for Debug 16 3 2 Running the Example Application 18 3 3 Debugging the Example Application 18 3 4 Programming the Debugged Application 21 3 5 Creating Other Applications 21 3 6 Determini...

Page 4: ...MPLAB Starter Kit for PIC18F User s Guide DS51852A page iv 2009 Microchip Technology Inc NOTES...

Page 5: ...ter kit using MPLAB IDE Chapter 4 Hardware This chapter provides a functional overview of the starter kit and identifies the major hardware components Appendix A Starter Kit Schematics This appendix p...

Page 6: ...og A menu selection select Enable Programmer Quotes A field name in a window or dialog Save project before build Underlined italic text with right angle bracket A menu path File Save Bold characters A...

Page 7: ...and specifications Also refer to the appropriate device Flash Programming Specification for information on instruction sets and firmware development These files may be found on the Microchip web site...

Page 8: ...ion whenever there are changes updates revisions or errata related to a specified product family or development tool of interest To register access the Microchip web site at www microchip com click on...

Page 9: ...E Technical Support 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...

Page 10: ...MPLAB Starter Kit for PIC18F User s Guide DS51852A page 6 2009 Microchip Technology Inc NOTES...

Page 11: ...mmer circuitry that allows applications to be programmed onto the application side of the PIC18F MCU and then debugged all using MPLAB IDE The need for an additional programmer or hardware interface h...

Page 12: ...e PC USB connection provides communication and power to the board The MicroSD Flash card used to store the demo applications may be inserted into the MicroSD slot at any time If the cable is connected...

Page 13: ...ed with a MicroSD bootloader that gives the ability to load program and run PIC18 applications from a MicroSD memory card The bootloader appli cation extensively uses and serves to demonstrate the Mic...

Page 14: ...t application programmed into the microcontroller is then executed Figure 2 2 shows a typical sequence of OLED messages from the bootloader initialization through the loading of an application read fr...

Page 15: ...ation USB Device HID Mouse Firmware mouse c on the starter kit CD demonstrates how to re enter the bootloader from the main application 2 2 USB HID MOUSE DEMO This demo uses the starter kit as a USB m...

Page 16: ...the on board accelerometer Like the Mouse Demo acceleration on all three axes is used to compute board tilt which is then converted to movement on the X and Y axis While holding the starter kit board...

Page 17: ...C application project HID PnP Demo exe provided on the CD ROM disc that comes with the kit If the USB device has been plugged in and has successfully enumerated the device should be detected automatic...

Page 18: ...it as a USB MicroSD card reader The MSD Mass Storage Device interface displays a new drive volume in My Computer similar to a USB Flash memory device thumb drive If a compatible card is inserted in th...

Page 19: ...ware and hardware together Special starter kit software interacts with the MPLAB IDE application to run stop and single step through programs Breakpoints can be set and the processor can be reset Once...

Page 20: ...ting that 1 new hardware has been found 2 drivers are being installed and 3 the new hardware is ready for use If you do not see these messages and the starter kit does not work try unplugging and reco...

Page 21: ...tures Figure 3 3 1 the status bar shows Starter Kits as the debug tool 2 a Starter Kit debug toolbar is added 3 the Debugger menu changes to add starter kit debug functions 4 the Output window display...

Page 22: ...he program execution A green solid arrow marks the line of code in the File window where the program Halted 4 Select Debugger Step Into or click the Step Into button to step the program execution once...

Page 23: ...reakpoint Double click again to remove the breakpoint Pop up Menu Place the cursor over the line of code where you want the break point Then right click to pop up a menu and select Set Breakpoint Once...

Page 24: ...ch It contains four selectable watch views via tabs in which to view variables SFRs symbols and absolute addresses Select an SFR or symbol from the list and click the related Add button to add it to t...

Page 25: ...e the design center at the Microchip web site www microchip com For additional information on the full ver sion of the MPLAB C Compiler for PIC18 MCUs go to http www microchip com c18 For additional i...

Page 26: ...back into the starter kit MPLAB IDE should automatically reconnect to the starter kit If this does not work do the following 1 Check the USB connection between the PC and starter kit at both ends 2 If...

Page 27: ...ter Kit for PIC18F comes preprogrammed with a MicroSD bootloader that has the ability to load program and run precompiled applications from a MicroSD memory card to the device s Flash program memory T...

Page 28: ...USB HID Joystick Demo The microcontroller uses the same SPI interface to communicate with the MicroSD memory card This allows the USB MSD Card Reader Demo to read and write files to any MicroSD memor...

Page 29: ...microcontroller manages debugging or programming of the target PIC18F46J50 by controlling the target s MCLR PGC1 EMUC1 and PGD1 EMUD1 signals Target clocking is provided by the PIC18F67J50 A Microchip...

Page 30: ...of their reference tags in Figure 4 3 are the key components of the application side of the starter kit A1 PIC18F46J50 Microcontroller U3 This provides the processing power for the demo applications a...

Page 31: ...functioning as a peripheral device A7 Potentiometer R24 Provides a variable analog input to the microcontroller for certain demo applications A8 Bootloader Reset Push Button S1 The switch provides a h...

Page 32: ...MPLAB Starter Kit for PIC18F User s Guide DS51852A page 28 2009 Microchip Technology Inc NOTES...

Page 33: ...Starter Kit Schematics The following schematic diagrams are included in this appendix Programmer Debugger Figure A 1 Programmer Debugger System Application Figure A 2 Application Microcontroller Touch...

Page 34: ...MPLAB Starter Kit for PIC18F User s Guide DS51852A page 30 2009 Microchip Technology Inc FIGURE A 1 STARTER KIT SCHEMATIC SHEET 1 PROGRAMMER DEBUGGER SYSTEM ICSP TEST DEBUG HEADER...

Page 35: ...2009 Microchip Technology Inc DS51852A page 31 FIGURE A 2 STARTER KIT SCHEMATIC SHEET 2 APPLICATION MICROCONTROLLER SOFT START POWER CIRCUIT ACCELEROMETER AND SWITCHES Not Populated Not Populated Not...

Page 36: ...Microchip Technology Inc FIGURE A 3 STARTER KIT SCHEMATIC SHEET 3 OLED DISPLAY SD INTERFACE APPLICATION SIDE USB CONNECTOR AND POWER SUPERVISOR AND OTHER CONNECTORS Not Populated Not Populated Not Pop...

Page 37: ...F To meet the specification the application can use current management techniques to limit the inrush current and spread the charge over a longer period of time B 1 2 Total Application Current Draw US...

Page 38: ...ld of Q1 Once the frequency is selected changing the PWM duty cycle will result in a change of the gate voltage The duty cycle is set so that the starting voltage on the gate of Q1 is above the thresh...

Page 39: ...er kit use three different software function calls to manage USB related power consump tion This section describes the functions provided and how they are used to meet the USB requirements B 3 1 AppPo...

Page 40: ...start should wait until AppPowerReady returns TRUE before running EXAMPLE B 1 USING AppPowerReady TO CONTROL APPLICATION START UP B 3 3 AppPowerDisable The AppPowerDisable function turns the power off...

Page 41: ...er kit for cost and available features the debugger section provides the system clock for both the debugger and the application portions of the circuit As a result the debugger is always running even...

Page 42: ...MPLAB Starter Kit for PIC18F User s Guide DS51852A page 38 2009 Microchip Technology Inc NOTES...

Page 43: ...ry Map 11 Writing Applications 11 C Charge Time Measurement Unit CTMU 24 Code Examples Using AppPowerDisable 36 Using AppPowerReady to Control Application Start up 36 Customer Change Notification Serv...

Page 44: ...Microchip Technology Inc DS51852A page 40 T Troubleshooting 22 U Unable to Enter Debug Mode 22 USB Current Specifications 33 Suspend Current Limitations 37 W Warranty Registration 2 Watch Window 18 WW...

Page 45: ...Index 2009 Microchip Technology Inc DS51852A page 41 NOTES...

Page 46: ...ng Tel 86 24 2334 2829 Fax 86 24 2334 2393 China Shenzhen Tel 86 755 8203 2660 Fax 86 755 8203 1760 China Wuhan Tel 86 27 5980 5300 Fax 86 27 5980 5118 China Xiamen Tel 86 592 2388138 Fax 86 592 23881...

Reviews: