MICROCHIP MPLAB IDE PICSTART PLUS USER’S GUIDE

MPLAB
PICSTART
USER’S GUIDE
®
IDE
®
PLUS
2004 Microchip Technology Inc. DS51028F
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 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 WAR­RANTIES 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 Microchip’s products 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, 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, Migratable Memory, MPASM, MPLIB, MPLINK, 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.
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.
®
8-bit MCUs, KEELOQ
®
code hopping
MPLAB® PICSTART® PLUS
USER’S GUIDE
Table of Contents
Preface ........................................................................................................................... 1
Chapter 1. PICSTART Plus Overview
1.1 Introduction ..................................................................................................... 5
1.2 What is PICSTART Plus Programmer? .......................................................... 5
1.3 PICSTART Plus System Components ........................................................... 5
1.4 PICSTART Plus CE Compliance .................................................................... 6
1.5 How the PICSTART Plus Programmer Helps You ......................................... 6
1.6 MPLAB Integrated Development Environment ............................................... 7
1.7 MPLAB Development Tools ........................................................................... 7
Chapter 2. PICSTART Plus Installation
2.1 Introduction ..................................................................................................... 9
2.2 Host Computer System Requirements ........................................................... 9
2.3 Installing MPLAB IDE Software ...................................................................... 9
2.4 Installing PICSTART Plus Hardware ............................................................ 10
2.5 Starting MPLAB IDE ..................................................................................... 11
2.6 Turning the PICSTART Plus On/Off ............................................................. 11
2.7 Selecting the Device ..................................................................................... 12
2.8 Selecting the PICSTART Plus Programmer ................................................. 13
2.9 Configuring the Serial Port for PICSTART Plus ........................................... 13
2.10 Enabling the PICSTART Plus ..................................................................... 15
Chapter 3. Tutorial
3.1 Introduction ................................................................................................... 17
3.2 Before You Begin ......................................................................................... 17
3.3 Programming Overview ................................................................................ 17
3.4 Selecting the Device ..................................................................................... 18
3.5 Creating the Project ...................................................................................... 19
3.6 Setting Up Language Tools .......................................................................... 20
3.7 Naming the Project ....................................................................................... 21
3.8 Adding Files to the Project ........................................................................... 22
3.9 Building the Initial Project ............................................................................. 24
3.10 Creating Code ............................................................................................ 25
3.11 Building the Project .................................................................................... 27
3.12 Enabling the PICSTART Plus ..................................................................... 28
3.13 Programming the Device ............................................................................ 29
3.14 Verifying the Programming ......................................................................... 29
3.15 Tutorial Summary ....................................................................................... 29
2004 Microchip Technology Inc. DS51028F-page iii
MPLAB® PICSTART® Plus User’s Guide
Chapter 4. Using the PICSTART Plus
4.1 Introduction ................................................................................................... 31
4.2 Preparation for Programming a Device ........................................................ 31
4.3 Procedure for Programming a Device .......................................................... 31
4.4 Verifying the Programming ........................................................................... 46
4.5 Reading a Device ......................................................................................... 46
Chapter 5. PICSTART Plus – MPLAB IDE Reference
5.1 Introduction ................................................................................................... 49
5.2 PICSTART Plus Toolbar .............................................................................. 49
5.3 Configure Menu ............................................................................................ 50
5.4 Debugger Menu ............................................................................................ 51
5.5 PICSTART Plus Programmer Menu ............................................................. 52
5.6 Programmer Settings ................................................................................... 58
5.7 Files Used by the PICSTART Plus Programmer .......................................... 61
5.8 Upgrading the PICSTART Plus Firmware OS .............................................. 62
Appendix A. Hardware Specifications
A.1 Introduction .................................................................................................. 67
A.2 Connecting to a PC via the Serial Port ........................................................ 67
A.3 Physical Dimensions and Layout ................................................................. 67
Appendix B. Troubleshooting
B.1 Introduction .................................................................................................. 69
B.2 Common Problems ...................................................................................... 69
B.3 Error Messages, Warnings and Announcements ........................................ 73
B.4 Limitations .................................................................................................... 76
Index .............................................................................................................................77
Worldwide Sales and Service .....................................................................................80
MPLAB® PICSTART® PLUS
USER’S GUIDE
Preface
NOTICE TO CUSTOMERS
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 IDE on-line help. Select the Help menu, and then Topics to open a list of available on-line help files.
INTRODUCTION
This chapter contains general information that will be useful to know before using the PICSTART Plus device programmer. Items discussed in this chapter include:
• About This Guide
• Warranty Registration
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
• Customer Support
ABOUT THIS GUIDE
Document Layout
This document describes how to use PICSTART Plus as a development tool to program firmware to a target device. The manual layout is as follows:
Chapter 1: PICSTART Plus Overview – Describes the PICSTART Plus and how
it works.
Chapter 2: PICSTART Plus Installation – How to install PICSTART Plus
hardware and MPLAB software.
Chapter 3: Tutorial – Contains tutorials for programming calibration memory
devices, memory devices and other PICmicro MCU devices.
Chapter 4: Using the PICSTART Plus – How to use PICSTART Plus to program
devices.
Chapter 5: PICSTART Plus – MPLAB IDE Reference – PICSTART Plus options
available through the PICSTART Plus menu and Options menu.
2004 Microchip Technology Inc. DS51028F-page 1
MPLAB® PICSTART® Plus User’s Guide
Appendix A: “Hardware Specifications” – Provides information on the 25-pin
serial port, changing voltages and programmer dimensions.
Appendix B: Troubleshooting – How to solve common problems.
Conventions Used in this Guide
This User's Guide 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...
Initial caps A window the Output window
A dialog the Settings dialog A menu selection select Enable Programmer
Quotes A field name in a window or
dialog
Underlined, italic text with right angle bracket
Bold characters A dialog button Click OK
‘bnnnn A binary number where n is a
Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>
Courier font:
Plain Courier Sample source code #define START
Italic Courier A variable argument file.o, where file can be
0xnnnn A hexadecimal number where
Square brackets [ ] Optional arguments mcc18 [options] file
Curly brackets and pipe character: { | }
Ellipses... Replaces repeated text var_name [,
A menu path File>Save
A tab Click the Power tab
digit
Filenames autoexec.bat File paths c:\mcc18\h Keywords _asm, _endasm, static Command-line options -Opa+, -Opa- Bit values 0, 1
n is a hexadecimal digit
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)
{ ... }
WARRANTY REGISTRATION
Please complete the enclosed Warranty Registration Card and mail it promptly. Sending in the Warranty Registration Card entitles users to receive new product updates. Interim software releases are available at the Microchip web site.
RECOMMENDED READING
This user's guide describes how to use MPLAB PICSTART Plus programmer. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources.
README for PICSTART Plus
For the latest information on using the PICSTART Plus, read the Readme for PICSTART Plus.txt file (an ASCII text file) in the Readmes subdirectory of the
MPLAB IDE installation directory. The Readme file contains update information and known issues that may not be included in this user’s guide.
PICSTART Plus On-line Help
MPLAB IDE V6.XX Quick Start Guide (DS51281)
Describes how to set up the MPLAB IDE software and use it to create projects and program devices.
MPASM™ User’s Guide with MPLINK™ Linker and MPLIB™ Librarian (DS33014)
This user’s guide describes how to use the Microchip PICmicro® MCU MPASM assembler, the MPLINK object linker and the MPLIB object librarian.
Preface
MPLAB IDE On-line Help
In-Circuit Serial Programming™ (ICSP™) Guide (DS30277)
This document contains helpful design guidelines to follow for successful ICSP programming. It includes application notes on hardware designs and the ICSP programming specifications.
THE MICROCHIP WEB SITE
Microchip provides online support via our WWW 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 (FAQ), 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
2004 Microchip Technology Inc. DS51028F-page 3
MPLAB® PICSTART® Plus User’s Guide
DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE
Microchip’s customer notification service helps keep customers current on Microchip products. Subscribers will receive e-mail notification 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 Customer Change Notification and follow the registration instructions.
The Development Systems product group categories are:
Compilers – The latest information on Microchip C compilers and other language
tools. These include the MPLAB C17, MPLAB C18 and MPLAB C30 C compilers; MPASM™ and MPLAB ASM30 assemblers; MPLINK™ and MPLAB LINK30 object linkers; and MPLIB™ and MPLAB LIB30 object librarians.
Emulators – The latest information on Microchip in-circuit emulators.This
includes the MPLAB ICE 2000 and MPLAB ICE 4000.
In-Circuit Debuggers – The latest information on the Microchip in-circuit
debugger, MPLAB ICD 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 and MPLAB SIM simulators, MPLAB IDE Project Manager and general editing and debugging features.
Programmers – The latest information on Microchip programmers. These include
the MPLAB PM3 and PRO MATE Plus development programmer.
®
II device programmers and the PICSTART®
®
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 International Locations
MPLAB® PICSTART® PLUS

Chapter 1. PICSTART Plus Overview

1.1 INTRODUCTION

This chapter presents an overview of the features and requirements of the PICSTART Plus development programmer. Topics covered in this chapter include:
• What is PICSTART Plus Programmer?
• PICSTART Plus System Components
• PICSTART Plus CE Compliance
• How the PICSTART Plus Programmer Helps You?

1.2 WHAT IS PICSTART PLUS PROGRAMMER?

The PICSTART Plus is a Microchip microcontroller development programmer that enables you to program user software into PICmicro microcontroller devices. Devices in non-DIP packages that are supported by the PICSTART Plus require the use of an adapter. Those currently available are listed on the Microchip web site.
Note: The PICSTART Plus programmer is designed for use in firmware
development and is not intended for production use.
USER’S GUIDE

1.3 PICSTART PLUS SYSTEM COMPONENTS

The PICSTART Plus development programmer system includes:
• PICSTART Plus development programmer (Figure 1-1)
• RS-232 Interface cable to connect to any standard PC serial port
• 9V power supply
• MPLAB IDE software - an Integrated Development Environment as detailed in
Section 1.7 “MPLAB Development Tools”
• Blank chip for programming
2004 Microchip Technology Inc. DS51028F-page 5
MPLAB® PICSTART® Plus User’s Guide
FIGURE 1-1: PICSTART PLUS DEVELOPMENT PROGRAMMER

1.4 PICSTART PLUS CE COMPLIANCE

The PICSTART Plus development system is designed, tested and certified to meet the Electromagnetic Compatibility requirements known as the CE compliance directives. These standards set by the European Union (EU) countries include limiting radiated emission, reducing susceptibility to radiated emission and reducing susceptibility to Electrostatic Discharge (ESD).

1.5 HOW THE PICSTART PLUS PROGRAMMER HELPS YOU

The PICSTART Plus development programmer has the following features:
• Programs PICmicro microcontrollers, including program memory, configuration bits and ID locations
• Operates as a Windows MPLAB Integrated Development Environment (IDE)
• Communicates with the PC via a standard RS-232 cable
• With MPLAB IDE, the user can create, display and edit data to be programmed into PICmicro microcontrollers (MCUs)
In addition, you can verify that PICmicro MCUs are blank, verify that code in the target microcontroller matches your firmware and you can read code from an unprotected PICmicro MCU into the MPLAB IDE program memory window for debugging and programming into other PICmicro MCU devices.
®
application on a PC-compatible host system within the
PICSTART Plus Overview

1.6 MPLAB INTEGRATED DEVELOPMENT ENVIRONMENT

The MPLAB desktop provides an environment for developing and debugging your application. PICSTART Plus is integrated into the MPLAB IDE.
This document covers the basic setup and operation of the PICSTART Plus device programmer, but it does not cover all functions of the MPLAB IDE. Read the MPLAB IDE documentation to get a full understanding of the features and debug capabilities of the MPLAB IDE.

1.7 MPLAB DEVELOPMENT TOOLS

The MPLAB IDE integrates several tools to provide a complete development environment.
• MPLAB Project Manager
The Project Manager is used to create a project and work with the specific files related to the project. When using a project, source code is rebuilt and downloaded to the simulator or emulator with a single mouse click.
• MPLAB Editor
The MPLAB Editor is used to create and edit text files such as source files, code and linker script files.
• MPLAB SIM Simulator
The software simulator models the instruction execution and I/O of the PICmicro MCUs.
• MPLAB ICD 2
Microchip’s In-Circuit Debugger that works with MPLAB IDE for PIC18FXXX devices.
• MPLAB ICE Emulator
The MPLAB ICE emulator uses hardware to emulate PICmicro MCUs in real time, either with or without a target system.
• MPASM Universal Assembler/MPLINK Relocatable Linker/MPLIB Librarian
The MPASM assembler allows source code to be assembled without leaving the MPLAB IDE. MPLINK creates the final application by linking relocatable modules from MPASM, MPLAB C17 and MPLAB C18. MPLIB manages custom libraries for maximum code reuse.
• MPLAB C17, MPLAB C18 and C30 C Compilers
The MPLAB C17, MPLAB C18 and MPLAB C30 C Compilers provide ANSI-based high level source code solutions. Complex projects can use a combination of C and assembly source files to obtain the maximum benefits of speed and maintainability.
• MPLAB PM3, PRO MATE II, PICSTART Plus and PICkit™ Programmers
Develop code with the simulator or an emulator, assemble or compile it, then use one of these tools to program devices. This can all be accomplished with the MPLAB IDE.
• Third Party Tools
Many other companies have development tools for Microchip products that work with the MPLAB IDE. Consult the Microchip web site for additional information.
2004 Microchip Technology Inc. DS51028F-page 7
MPLAB® PICSTART® Plus User’s Guide
NOTES:

Chapter 2. PICSTART Plus Installation

2.1 INTRODUCTION

The PICSTART Plus development system requires connecting the hardware to the PC and the installation of the MPLAB IDE software.
This chapter covers:
• Host Computer System Requirements
• Installing MPLAB IDE Software
• Installing PICSTART Plus Hardware
• Starting MPLAB IDE
• Turning the PICSTART Plus On/Off
• Selecting the Device
• Selecting the PICSTART Plus Programmer
• Configuring the Serial Port for PICSTART Plus
• Enabling the PICSTART Plus
MPLAB® PICSTART® PLUS
USER’S GUIDE

2.2 HOST COMPUTER SYSTEM REQUIREMENTS

The following minimum configuration is required to run the MPLAB IDE:
®
• PC-compatible Intel Pentium
• Microsoft Windows Workstations (NOT Servers), or Windows 2000 SP2 Windows
• 32 MB memory (128 MB recommended)
• 85 MB of hard disk space
• Internet Explorer 5.0 or greater for installation and on-line Help
• One serial port
®
98 SE, Windows ME, Windows XP, Windows NT® 4.0 SP6a
class system
2.3 INSTALLING MPLAB IDE SOFTWARE
Install the MPLAB IDE software by following the instructions in the MPLAB IDE documentation. Refer to the MPLAB IDE documentation for more detailed instructions.
• Insert the MPLAB IDE CD-ROM into your CD-ROM drive (Example: drive D). The CD will automatically begin the setup.
• Follow the on-screen instructions to install the MPLAB IDE.
2004 Microchip Technology Inc. DS51028F-page 9
MPLAB® PICSTART® Plus User’s Guide

2.4 INSTALLING PICSTART PLUS HARDWARE

The PICSTART Plus hardware is simple to set up. First, the communications cable is attached, and then the power supply is connected.
2.4.1 Installing the Communications Cable
PICSTART Plus provides communications with the host PC via an RS-232 9-pin, D type connector. PICSTART Plus is Data Communication Equipment (DCE), and hardware handshaking is via Clear-To-Send (CTS) and Request-To-Send (RTS).
A 6-foot data cable with DB-9 connectors is supplied with PICSTART Plus. All lines on the data cable are wired straight through. This cable is NOT a null modem cable.
To install the serial communications cable:
1. Connect one end of the cable to an available COM port on your PC. Check your PC setup to see which communications port is available.
2. Connect the cable from your COM port to the PICSTART Plus development programmer.
2.4.2 Installing the Power Supply
The PICSTART Plus comes with a 9V input power supply. PICSTART Plus requires +9 volts ±10% at 500 mA (max.) on the center positive 2.5 mm terminal.
To install the power supply:
1. Plug the power cable attached to the power supply into a power outlet.
2. Connect the thin power supply cable to the PICSTART Plus. This supplies power to the PICSTART Plus programmer. The green power light will come on.
WARNING
DO NOT connect power with a device in the socket. Damage to the device may result.

2.5 STARTING MPLAB IDE

To start the MPLAB IDE, double click on the icon installed on the desktop after installation or select Start>Programs>Microchip MPLAB IDE>MPLAB IDE will display the MPLAB IDE logo followed by the MPLAB IDE desktop. The MPLAB IDE desktop should look similar to Figure 2-1.
FIGURE 2-1: MPLAB IDE DESKTOP
PICSTART Plus Installation
. A screen
2.6 TURNING THE PICSTART PLUS ON/OFF
Simply plug in or unplug the PICSTART Plus power supply to turn the programmer on or off, respectively.
2004 Microchip Technology Inc. DS51028F-page 11
MPLAB® PICSTART® Plus User’s Guide

2.7 SELECTING THE DEVICE

Select Configure>Select Device to select a device from the list of available devices (see Figure 2-2). When you select a device, indicators next to the Microchip Tools names show the level of support for that device: green - supports the device, yellow ­limited support and red - no support. If the selected device is supported by PICSTART Plus, click OK.
If you select a device that is incompatible with PICSTART Plus, a warning displays stating PICSTART Plus does not support that device.
FIGURE 2-2: SELECT DEVICE DIALOG
PICSTART Plus Installation

2.8 SELECTING THE PICSTART PLUS PROGRAMMER

Select Programmer>Select Programmer>PICSTART Plus from the MPLAB IDE menu to select the programmer (Figure 2-3). Once the programmer is selected, PICSTART Plus appears at the bottom of the screen.
FIGURE 2-3: SELECT PROGRAMMER

2.9 CONFIGURING THE SERIAL PORT FOR PICSTART PLUS

To configure the serial port for the PICSTART Plus, select Programmer> Settings (Figure 2-4) and click on the Communications tab. A dialog similar to the one shown in Figure 2-5 will appear.
FIGURE 2-4: PROGRAMMER SETTINGS
2004 Microchip Technology Inc. DS51028F-page 13
MPLAB® PICSTART® Plus User’s Guide
FIGURE 2-5: COMMUNICATIONS PORT SETUP DIALOG
The Communications tab shows the possible PC serial communication ports. Select the COM port used for the PICSTART Plus. If a COM port number between 4 and 255 has been configured for use on the workstation, type the number in the “Other” text box. Click OK to set the COM port or click Cancel if you want to close the dialog without selecting a COM port.
Note: The programmer uses COM 1 as the default serial port. If you change your
serial port selection, then the next time you run your programmer, the host software will use the same serial port used in the previous session.

2.10 ENABLING THE PICSTART PLUS

You should select a device that is supported by the firmware in use before enabling the programmer. Select Configure>Select Device PICSTART Plus. To check that the PC and the programmer are communicating properly, select Programmer>Enable Programmer PICSTART Plus programmer.
FIGURE 2-6: ENABLING THE PICSTART PLUS
PICSTART Plus Installation
and choose a device supported by the
(see Figure 2-6) enable the
If PICSTART Plus is not found on the selected COM port, a dialog similar to Figure 2-7 appears.
FIGURE 2-7: COMMUNICATIONS ERROR DIALOG
If you cannot establish communications between the PC and PICSTART Plus, make sure you have installed the hardware and software correctly (see
Section 2.4 “Installing PICSTART Plus Hardware” and Section 2.3 “Installing MPLAB IDE Software”). If you still cannot establish communications between the PC
and PICSTART Plus, please see Appendix B. “Troubleshooting”.
If you have been using another programmer (e.g., PRO MATE II) with a device that is not supported by the PICSTART Plus, the PICSTART Plus programmer menu might not be available. Ensure that the device currently selected is supported by the PICSTART Plus and the firmware in use (see Section 2.7 “Selecting the Device”). Select Programmer>Select Programmer then select Programmer>Enable Programmer
and choose PICSTART Plus from the list,
to enable the PICSTART Plus.
2004 Microchip Technology Inc. DS51028F-page 15
MPLAB® PICSTART® Plus User’s Guide
NOTES:

3.1 INTRODUCTION

The tutorial in this chapter leads you through the steps involved in programming the PIC18F452 PICmicro device using MPLAB IDE Project Wizard.

3.2 BEFORE YOU BEGIN

Before you can begin this tutorial, you must:
1. Install the MPLAB IDE software. See Section 2.3 “Installing MPLAB IDE
Software”.
2. Install the PICSTART Plus hardware. See Section 2.4 “Installing PICSTART
Plus Hardware”.
3. Make sure you have read and completed all the instructions in
Section 2.6 “Turning the PICSTART Plus On/Off” and Section 2.9 “Configuring the Serial Port for PICSTART Plus”.
4. Make sure that your PC and PICSTART Plus are communicating and the
PICSTART Plus menu appears on the MPLAB menu before you begin this tutorial.
MPLAB® PICSTART® PLUS
USER’S GUIDE

Chapter 3. Tutorial

3.3 PROGRAMMING OVERVIEW

Programming a mid-range PICmicro device involves the following steps:
• Selecting the Device
• Creating the Project
• Setting Up Language Tools
• Naming the Project
• Adding Files to the Project
• Building the Initial Project
• Creating Code
• Building the Project
• Enabling the PICSTART Plus
• Programming the Device
• Verifying the Programming
2004 Microchip Technology Inc. DS51028F-page 17
MPLAB® PICSTART® Plus User’s Guide

3.4 SELECTING THE DEVICE

If you have not already selected the device in MPLAB IDE, do so by selecting
Configure>Select Device
PIC18F452 device.
Under Microchip Programmer Tool Support, verify that this device is supported (green light) by the PICSTART Plus. Click OK.
FIGURE 3-1: SELECTING THE DEVICE
to open the Select Device dialog (Figure 3-1) and select the

3.5 CREATING THE PROJECT

In order to program the device, you’ll need a hex file. In this example, we’ll create a project to generate the hex file using the Project Wizard. We will use a single assembly file for this project and a linker script. Choose the Project>Project Wizard the Project Wizard and display the Welcome screen (Figure 3-2).
Note: Before using the Project Wizard, check that the option to associate the
project with the workspace is enabled. Select Configure>Settings click on the Projects tab. Select the check box for “Use one-to-one project-workspace model” and click OK.
FIGURE 3-2: PROJECT WIZARD WELCOME SCREEN
Tutorial
to begin using
, then
Click on Next> to advance to the next dialog in the Project Wizard.
This dialog (Figure 3-3) allows you to select the device, which we’ve already done. Make
Next>
sure “PIC18F452” is selected. Otherwise, select the PIC18F452 device. Click
FIGURE 3-3: PROJECT WIZARD - SELECT DEVICE
.
2004 Microchip Technology Inc. DS51028F-page 19
MPLAB® PICSTART® Plus User’s Guide

3.6 SETTING UP LANGUAGE TOOLS

In Step Two of the Project Wizard, select “Microchip MPASM Toolsuite” in the Active Toolsuite list box. Then you should see “MPASM” and “MPLINK” show up in the Toolsuite Contents box. You can click on each one to see its location. If you installed MPLAB IDE into the default directory, the MPASM assembler executable will be:
C:\Program Files\MPLAB IDE\MCHIP_Tools\mpasmwin.exe
and the MPLINK linker executable will be:
C:\Program Files\MPLAB IDE\MCHIP_Tools\mplink.exe
If these do not show up correctly, use the browse button to set them to the proper files in the MPLAB IDE subfolders.
FIGURE 3-4: SETTING LANGUAGE TOOL LOCATION
When you are finished, click Next>. Then, click OK.

3.7 NAMING THE PROJECT

Step Three of the wizard allows you to name the project and put it into a folder. This sample project will be called 18F452Proj, and using the Browse button, go to the C drive and make a new folder called My Projects. Click Next>.
FIGURE 3-5: PROJECT WIZARD - NAME PROJECT
Tutorial
2004 Microchip Technology Inc. DS51028F-page 21
MPLAB® PICSTART® Plus User’s Guide

3.8 ADDING FILES TO THE PROJECT

Step Four of the Project Wizard allow us to select files for the project. We do not have a source file yet, so we will use an MPLAB IDE template file. The template files are simple files that can be used to start a project. They have the essential sections for any source file, and have information in them that will help you write and organize your code. These files are the MPLAB IDE folder, which by default is in the Program Files folder on your PC. There is one template file for each Microchip PICmicro and dsPIC device.
Scroll to the Program Files folder on Drive C:, open it, and scroll down to the MPLAB IDE folder. Open the MPLAB IDE folder and scroll down to the Mchip_Tools direc­tory. Open the Mchip_Tools directory and get a template from the Object folder in the Template folder, and choose the file named f452tmpo.asm.
If you installed MPLAB IDE in the default location, the full path to the file will be:
C:\Program Files\MPLAB IDE\MCHIP_Tools\TEMPLATE\Object\f452tmpo.asm
FIGURE 3-6: PROJECT WIZARD - SELECT TEMPLATE FILE
Press Add>> to move the file name to the right panel, and click on the check box at the start of the line with the file name to enable this file to be copied to our project directory.
Loading...
+ 58 hidden pages