MPLAB IDE Quick Start Guide
Total Page:16
File Type:pdf, Size:1020Kb
MPLAB® IDE QUICK START GUIDE 2004 Microchip Technology Inc. DS51281D 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 Trademarks applications and the like is provided only for your convenience The Microchip name and logo, the Microchip logo, Accuron, and may be superseded by updates. It is your responsibility to dsPIC, KEELOQ, microID, MPLAB, PIC, PICmicro, PICSTART, ensure that your application meets with your specifications. PRO MATE, PowerSmart, rfPIC, and SmartShunt are MICROCHIP MAKES NO REPRESENTATIONS OR WAR- registered trademarks of Microchip Technology Incorporated RANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, in the U.S.A. and other countries. WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB, LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, PICMASTER, SEEVAL, SmartSensor and The Embedded MERCHANTABILITY OR FITNESS FOR PURPOSE. Control Solutions Company are registered trademarks of Microchip disclaims all liability arising from this information and Microchip Technology Incorporated in the U.S.A. its use. Use of Microchip’s products as critical components in Analog-for-the-Digital Age, Application Maestro, dsPICDEM, life support systems is not authorized except with express dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR, written approval by Microchip. No licenses are conveyed, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial implicitly or otherwise, under any Microchip intellectual property Programming, ICSP, ICEPIC, MPASM, MPLIB, MPLINK, rights. 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. 11/12/04 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, KEELOQ® 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. DS51281D-page ii 2004 Microchip Technology Inc. MPLAB® IDE QUICK START GUIDE Table of Contents ® Chapter 1. What is MPLAB IDE? 1.1 An Overview of Embedded Systems .............................................................. 1 1.2 The Development Cycle ................................................................................. 6 1.3 Project Manager ............................................................................................. 7 1.4 Language Tools .............................................................................................. 8 1.5 Target Debugging ........................................................................................... 9 1.6 Device Programming .................................................................................... 10 1.7 Components of MPLAB IDE ......................................................................... 10 1.8 MPLAB IDE Documentation ......................................................................... 11 1.9 MPLAB IDE On-line Help ............................................................................. 11 1.10 MPLAB IDE Updates and Version Numbering ........................................... 14 Chapter 2. Getting Started with MPLAB IDE: A Basic Tutorial 2.1 Introduction ................................................................................................... 15 2.2 MPLAB IDE Features and Installation .......................................................... 16 2.3 Tutorial Overview ......................................................................................... 18 2.4 Select Device ............................................................................................... 19 2.5 Create Project .............................................................................................. 21 2.6 Select Language Tools ................................................................................. 22 2.7 Put Files in Project ....................................................................................... 23 2.8 Build the Project ........................................................................................... 26 2.9 Create Code ................................................................................................. 27 2.10 Build the Project Again ............................................................................... 30 2.11 Test Code with Simulator ........................................................................... 31 2.12 Tutorial Summary ....................................................................................... 37 Worldwide Sales and Service .................................................................................... 40 2004 Microchip Technology Inc. DS51281D-page iii MPLAB® IDE Quick Start Guide NOTES: DS51281D-page iv 2004 Microchip Technology Inc. MPLAB® IDE QUICK START GUIDE Chapter 1. What is MPLAB® IDE? 1.1 AN OVERVIEW OF EMBEDDED SYSTEMS MPLAB IDE is a software program that runs on a PC to develop applications for Microchip microcontrollers. It is called an Integrated Development Environment, or IDE, because it provides a single integrated “environment” to develop code for embedded microcontrollers. Experienced embedded systems designers may want to skip ahead to Section 1.7 “Components of MPLAB IDE”. It is also recommended that Section 1.9 “MPLAB IDE On-line Help” and Section 1.10 “MPLAB IDE Updates and Version Numbering” be reviewed. The rest of this chapter briefly explains embedded systems development and how MPLAB IDE is used. 1.1.1 Description of an “Embedded System” An embedded system is typically a design making use of the power of a small microcontroller, like the Microchip PICmicro® MCU or dsPIC® Digital Signal Controller (DSCs). These microcontrollers combine a microprocessor unit (like the CPU in a desktop PC) with some additional circuits called “peripherals”, plus some additional circuits on the same chip to make a small control module requiring few other external devices. This single device can then be embedded into other electronic and mechanical devices for low-cost digital control. 1.1.2 Differences Between an Embedded Controller and a PC The main difference between an embedded controller and a PC is that the embedded controller is dedicated to one specific task or set of tasks. A PC is designed to run many different types of programs and to connect to many different external devices. An embedded controller has a single program and, as a result, can be made cheaply to include just enough computing power and hardware to perform that dedicated task. A PC has a relatively expensive generalized central processing unit (CPU) at its heart with many other external devices (memory, disk drives, video controllers, network interface circuits, etc.). An embedded system has a low-cost microcontroller unit (MCU) for its intelligence, with many peripheral circuits on the same chip, and with relatively few external devices. Often, an embedded system is an invisible part, or sub-module of another product, such as a cordless drill, refrigerator or garage door opener. The controller in these products does a tiny portion of the function of the whole device. The controller adds low-cost intelligence to some of the critical sub-systems in these devices. An example of an embedded system is a smoke detector. It’s function is to evaluate signals from a sensor and sound an alarm if the signals indicate the presence of smoke. A small program in the smoke detector either runs in an infinite loop, sampling