Microchip Technology MPLAB User Manual
Microchip Technology MPLAB User Manual

Microchip Technology MPLAB User Manual

Starter kit for pic18f
Hide thumbs Also See for MPLAB:

Advertisement

Quick Links

MPLAB Starter Kit
for PIC18F User's Guide
© 2009 Microchip Technology Inc.
DS51852A

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MPLAB and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Microchip Technology MPLAB

  • Page 1 MPLAB Starter Kit for PIC18F User’s Guide © 2009 Microchip Technology Inc. DS51852A...
  • Page 2 Select Mode, Total Endurance, TSHARC, WiperLock and ZENA 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.
  • Page 3: Table Of Contents

    MPLAB STARTER KIT FOR PIC18F USER’S GUIDE Table of Contents Preface ........................... 1 Chapter 1. Introduction to the Starter Kit 1.1 Overview ......................7 1.2 Operational Requirements ................7 1.3 Initial Board Setup ..................7 Chapter 2. The Demonstration Application 2.1 Bootloader From the MicroSD™...
  • Page 4 MPLAB Starter Kit for PIC18F User’s Guide NOTES: © 2009 Microchip Technology Inc. DS51852A-page iv...
  • Page 5: Preface

    “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 IDE online help. Select the Help menu, and then Topics to open a list of available online help files.
  • Page 6 MPLAB Starter Kit for PIC18F User’s Guide CONVENTIONS USED IN THIS GUIDE This manual uses the following documentation conventions: DOCUMENTATION CONVENTIONS Description Represents Examples Arial font: ® Italic characters Referenced books MPLAB IDE User’s Guide Emphasized text ...is the only compiler...
  • Page 7 Preface RECOMMENDED READING This user’s guide describes how to use the MPLAB Starter Kit for PIC18F. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources. Readme Files For the latest information on using other tools, read the tool-specific Readme files in the Readmes subdirectory of the MPLAB IDE installation directory.
  • Page 8 These include MPLAB ICD 2 and PICkit™ 2. ® • MPLAB IDE – The latest information on Microchip MPLAB IDE, the Windows Integrated Development Environment for development systems tools. This list is focused on the MPLAB IDE, MPLAB IDE Project Manager, MPLAB IDE Editor and MPLAB SIM Simulator, as well as general editing and debugging features.
  • Page 9 Technical support is available through the web site at: http://support.microchip.com DOCUMENT REVISION HISTORY Revision A (June 2009) • Initial Release of this Document © 2009 Microchip Technology Inc. DS51852A-page 5...
  • Page 10 MPLAB Starter Kit for PIC18F User’s Guide NOTES: © 2009 Microchip Technology Inc. DS51852A-page 6...
  • Page 11: Chapter 1. Introduction To The Starter Kit

    INITIAL BOARD SETUP With its pre-installed demo application, the MPLAB Starter Kit for PIC18F is designed to be used straight out of the box. Except for a single connection to a computer, no additional hardware or configuration is necessary.
  • Page 12 Before connecting the starter kit to any computer for the first time, it is important to install the accompanying software on the MPLAB Starter Kit for PIC18F CD first. This ensures that both the MPLAB development environment and C compiler, as well as the relevant tutorial and help files for the starter kit, are ready to use when the board is connected.
  • Page 13: Chapter 2. The Demonstration Application

    Chapter 2. The Demonstration Application This chapter describes the precompiled demonstration applications that are provided with the MPLAB Starter Kit for PIC18F, and how various features highlight the device’s processing power and hardware functionality. These include: • Bootloader from the MicroSD Memory Card •...
  • Page 14 MPLAB Starter Kit for PIC18F User’s Guide When the MicroSD bootloader starts, it initializes the capacitive touch routines and the OLED display. It then monitors for a MicroSD memory card insertion. When an insert event is detected by the bootloader, the MDD file system is initialized and the file structure is displayed on the OLED.
  • Page 15: Usb Hid Mouse Demo

    ® When using the MPLAB C18 C compiler to develop PIC18F firmware for an application, the linker file must be changed to protect the program memory used by the bootloader and the interrupt handler must be updated with the new vectors.
  • Page 16: Usb Hid Joystick Demo

    MPLAB Starter Kit for PIC18F User’s Guide USB HID JOYSTICK DEMO This demo uses the starter kit as a USB joystick. To test the joystick feature, open the Game Controller applet in the Control Panel. In the following dialog, select “Joystick Demo” under “Installed Game Controllers”, then click Properties.
  • Page 17: Usb Hid Custom Device Demo

    The state of the touch pads (pressed or not) is displayed in the Visual tab; all of the raw data is displayed in the Numeric tab. FIGURE 2-5: HID DEMO APPLICATION, VISUAL (LEFT) AND NUMERIC TABS © 2009 Microchip Technology Inc. DS51852A-page 13...
  • Page 18: Usb Cdc Demo

    MPLAB Starter Kit for PIC18F User’s Guide Note: The demo PC application is intended to be run under Windows and was ® ® written in Microsoft Visual C++ . If the executable fails to launch correctly, verify that the .NET Framework Version 2.0 (or later) redistributable pack- age has been installed.
  • Page 19: Chapter 3. Developing An Application

    This greatly assists you in debugging your firmware 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.
  • Page 20: Setting Up An Example Application For Debug

    MPLAB Starter Kit for PIC18F User’s Guide SETTING UP AN EXAMPLE APPLICATION FOR DEBUG Once the starter kit software is installed, the on-board debugger must be connected to any available USB port on the PC or powered hub, then to the starter kit at the mini-B receptacle, J2, on the debugger/programmer side of the board (Figure 3-1).
  • Page 21 Developing an Application The MPLAB IDE software that is installed on your PC by the starter kit CD-ROM auto- matically opens an example application that you may use to examine debug features of the starter kit. To prepare the application for debug: 1.
  • Page 22: Running The Example Application

    For the example code given, everything works fine. However, when you are developing code, it will likely not work the first time and need to be debugged. MPLAB IDE provides an editor and several debug features, such as breakpoints and Watch windows, to aid in application code debugging.
  • Page 23 • Double-click on a file in the Project window to open an existing code file. See an example Project window in Figure 3-4. FIGURE 3-4: EXAMPLE PROJECT For more information on using the editor to create and edit code, see MPLAB IDE Editor Help. 3.3.2 Using Breakpoints and Mouseovers To set a breakpoint in code, use one of the following methods: •...
  • Page 24 Watch window, or click in the “Address” column and enter an absolute address. A Watch window populated with the SFRs and Symbols will look like Figure 3-6. For more on using Watch windows, see MPLAB IDE Help. FIGURE 3-6: EXAMPLE WATCH WINDOW ©...
  • Page 25: Programming The Debugged Application

    It also uses program memory and file register loca- tions in the target device during debugging. These locations are not available for use by user code. In the MPLAB IDE; registers marked with an “R” in the register displays represent reserved registers.
  • Page 26: Troubleshooting

    1. Unplug the USB cable from the starter kit. 2. Plug the USB cable 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.
  • Page 27: Chapter 4. Hardware

    MPLAB STARTER KIT FOR PIC18F USER’S GUIDE Chapter 4. Hardware This chapter provides a functional overview of the MPLAB Starter Kit for PIC18F, and identifies the major hardware components. Topics covered include: • Application Functional Overview • Programmer/Debugger Functional Overview •...
  • Page 28: Programmer/Debugger Functional Overview

    MPLAB Starter Kit for PIC18F User’s Guide The microcontroller uses one of its A/D Converter channels to sample and convert the potentiometer’s value to a digital value. Four additional A/D channels are used to monitor the directional touch pads of S1. The values from these channels are analyzed with the CTMU to determine when a touch-and-release event occurs on any of the pads.
  • Page 29: Board Components

    A Microchip 25LC010A serial EEPROM is used to store the starter kit’s serial number and debug control information. BOARD COMPONENTS Figure 4-3 identifies the key hardware components for the starter kit. FIGURE 4-3: PIC18F STARTER KIT COMPONENT LAYOUT © 2009 Microchip Technology Inc. DS51852A-page 25...
  • Page 30 MPLAB Starter Kit for PIC18F User’s Guide TABLE 4-1: PIC18F STARTER KIT COMPONENT DESCRIPTIONS Debug/Programmer Component Application Component PIC18F67J50 Microcontroller (U1) PIC18F46J50 Microcontroller (U3) mini-B USB Receptacle (J2) OLED Display (LED1) Debugger/Programmer Clock Crystal (Y1) MicroSD™ Card Socket (J5) 25LC010A Serial EEPROM (U2)
  • Page 31 A11. MCP1727 Voltage Regulator (U5): The 3.3V linear regulator regulates the USB unregulated voltage to 3.3 volts (with respect to V ) and supplies the starter kit with system power. © 2009 Microchip Technology Inc. DS51852A-page 27...
  • Page 32 MPLAB Starter Kit for PIC18F User’s Guide NOTES: © 2009 Microchip Technology Inc. DS51852A-page 28...
  • Page 33: Appendix A. Starter Kit Schematics

    MPLAB STARTER KIT FOR PIC18F USER’S GUIDE Appendix A. 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 Switches and Associated Components • Figure A-3: OLED Display, LED and Application Side USB Connectors ©...
  • Page 34 MPLAB Starter Kit for PIC18F User’s Guide FIGURE A-1: STARTER KIT SCHEMATIC, SHEET 1: PROGRAMMER/DEBUGGER SYSTEM © 2009 Microchip Technology Inc. DS51852A-page 30...
  • Page 35 Starter Kit Schematics FIGURE A-2: STARTER KIT SCHEMATIC, SHEET 2: APPLICATION MICROCONTROLLER, SOFT START POWER CIRCUIT, ACCELEROMETER AND SWITCHES © 2009 Microchip Technology Inc. DS51852A-page 31...
  • Page 36 MPLAB Starter Kit for PIC18F User’s Guide FIGURE A-3: STARTER KIT SCHEMATIC, SHEET 3: OLED DISPLAY, SD INTERFACE, APPLICATION SIDE USB CONNECTOR AND POWER SUPERVISOR, AND OTHER CONNECTORS © 2009 Microchip Technology Inc. DS51852A-page 32...
  • Page 37: Appendix B. Usb Current Draw Requirements

    Appendix B. USB Current Draw Requirements This chapter describes the key USB specification current limits and provides a func- tional overview of the soft start circuitry used by the MPLAB Starter Kit for PIC18F to meet them. The appendix includes the following sections: •...
  • Page 38: Pic18F Soft Start Circuitry

    MPLAB Starter Kit for PIC18F User’s Guide 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.
  • Page 39: Soft Start Functions And Usage

    APP_POWER_AUTO_ENABLE is defined. In light of the Total Application Current Draw specification of 100 mA, this function should not be called until after the device is enumerated. See the following section for more details. © 2009 Microchip Technology Inc. DS51852A-page 35...
  • Page 40 MPLAB Starter Kit for PIC18F User’s Guide B.3.2 AppPowerReady() The AppPowerReady() function returns a BOOL data type that will return TRUE if the soft start is complete or FALSE if it is not. This function should be called periodically during the soft start to insure that the soft start continues ramping properly.
  • Page 41: Usb Suspend Current Limitations For The Starter Kit

    USB suspend specification. This can be achieved by switching to a lower clock frequency or placing the microcontroller into Sleep mode, among other possible methods. © 2009 Microchip Technology Inc. DS51852A-page 37...
  • Page 42 MPLAB Starter Kit for PIC18F User’s Guide NOTES: © 2009 Microchip Technology Inc. DS51852A-page 38...
  • Page 43: Index

    MPLAB STARTER KIT FOR PIC18F USER’S GUIDE Index Debugger Toolbar Animate............. 18 Acceleration Sensor ........11 Halt..............18 Application Components Reset..............18 Soft Start Circuit..........27 Run ..............18 Application Components Step Into............18 Acceleration Sensor.......... 27 Step Over............18 Bootloader Reset Push Button ......27 Demonstration Applications Capacitive Touch Pad........
  • Page 44 Index Troubleshooting ............22 Unable to Enter Debug Mode ........22 Current Specifications........33 Suspend Current Limitations ......37 Warranty Registration ..........2 Watch Window ............18 WWW Address............4 © 2009 Microchip Technology Inc. DS51852A-page 40...
  • Page 45 Index NOTES: © 2009 Microchip Technology Inc. DS51852A-page 41...
  • Page 46: Worldwide Sales And Service

    Thailand - Bangkok Santa Clara, CA Tel: 86-29-8833-7252 Tel: 66-2-694-1351 Tel: 408-961-6444 Fax: 86-29-8833-7256 Fax: 66-2-694-1350 Fax: 408-961-6445 China - Zhuhai Toronto Tel: 86-756-3210040 Mississauga, Ontario, Fax: 86-756-3210049 Canada Tel: 905-673-0699 Fax: 905-673-6509 03/26/09 © 2009 Microchip Technology Inc. DS51852A-page 42...

Table of Contents