Microchip Technology MPLAB PM3 User’s Guide

MPLAB® PM3
USER’S GUIDE
© 2006 Microchip Technology Inc. DS51464C
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 devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. 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, Migratable Memory, MXDEV, MXLAB, 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, Linear Active Thermistor, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo, PowerMate, PowerTool, Real ICE, rfLAB, rfPICDEM, Select Mode, Smart Serial, SmartTel, Total Endurance, UNI/O, 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.
© 2006, 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
DS51464C-page ii © 2006 Microchip Technology Inc.
MPLAB® PM3
USER’S GUIDE
Table of Contents
Preface ........................................................................................................................... 1
Chapter 1. MPLAB PM3 Overview
1.1 Introduction ..................................................................................................... 7
1.2 What is MPLAB PM3? .................................................................................... 7
1.3 What MPLAB PM3 Does ................................................................................ 7
1.4 MPLAB PM3 System Components ................................................................ 8
1.5 MPLAB PM3 CE Compliance ......................................................................... 8
1.6 How MPLAB PM3 Helps You ......................................................................... 9
1.7 MPLAB PM3 Operating with a PC .................................................................. 9
1.8 MPLAB PM3 Operating without a PC (Stand-alone) ...................................... 9
1.9 MPLAB Integrated Development Environment ............................................... 9
1.10 MPLAB Development Tools ....................................................................... 10
Chapter 2. Installing MPLAB PM3
2.1 Introduction ................................................................................................... 11
2.2 Installing MPLAB PM3 Software .................................................................. 11
2.3 Installing MPLAB PM3 Hardware ................................................................. 12
2.4 Powering Up MPLAB PM3 ........................................................................... 15
2.5 Configuring MPLAB IDE for Use with MPLAB PM3 ..................................... 16
Chapter 3. Tutorial
3.1 Introduction ................................................................................................... 23
3.2 Before You Begin ......................................................................................... 23
3.3 Programming Overview ................................................................................ 23
3.4 Selecting the Device ..................................................................................... 24
3.5 Creating the Project ...................................................................................... 24
3.6 Setting Up Language Tools .......................................................................... 26
3.7 Naming the Project ....................................................................................... 27
3.8 Adding Files to the Project ........................................................................... 28
3.9 Building the Initial Project ............................................................................. 30
3.10 Creating Code ............................................................................................ 31
3.11 Building the Project .................................................................................... 34
3.12 Enabling MPLAB PM3 ................................................................................ 35
3.13 Programming the Device ............................................................................ 36
3.14 Verifying the Programming ......................................................................... 36
3.15 Tutorial Summary ....................................................................................... 36
© 2006 Microchip Technology Inc. DS51464C-page iii
MPLAB® PM3 User’s Guide
Chapter 4. Using MPLAB PM3 with MPLAB IDE
4.1 Introduction ................................................................................................... 37
4.2 Before You Begin ......................................................................................... 37
4.3 MPLAB PM3 Dialogs .................................................................................... 37
4.4 Setup for Programming a Device ................................................................. 37
4.5 Programming a Device ................................................................................. 38
4.6 Verifying the Programming ........................................................................... 42
4.7 Reading a Device ......................................................................................... 43
4.8 Special Programming ................................................................................... 43
Chapter 5. Using MPLAB PM3 in Stand-Alone Mode
5.1 Introduction ................................................................................................... 45
5.2 Getting Started in Stand-alone Mode ........................................................... 45
5.3 Programming a Device ................................................................................. 46
Chapter 6. Using the MPLAB PM3 Card
6.1 Introduction ................................................................................................... 49
6.2 MPLAB PM3 Environment ............................................................................ 50
6.3 MPLAB PM3 Card ........................................................................................ 53
Chapter 7. MPLAB PM3 – MPLAB IDE Reference
7.1 Introduction ................................................................................................... 55
7.2 MPLAB PM3 Toolbar .................................................................................... 55
7.3 Configure Menu ............................................................................................ 56
7.4 MPLAB PM3 Programmer Menu .................................................................. 57
7.5 Programmer Settings ................................................................................... 62
7.6 Special Programming ................................................................................... 70
7.7 Files Used by MPLAB PM3 .......................................................................... 74
7.8 Upgrading the MPLAB PM3 Operating System ........................................... 75
Chapter 8. Stand-Alone Reference
8.1 Introduction ................................................................................................... 77
8.2 MPLAB PM3 LCD and Keys ......................................................................... 77
8.3 Start-Up Sequence ....................................................................................... 78
8.4 Main Menu .................................................................................................... 78
8.5 Command Menu ........................................................................................... 82
Chapter 9. MPLAB PM3 Card Reference
9.1 Introduction ................................................................................................... 87
9.2 MPLAB PM3 Card ........................................................................................ 87
9.3 MPLAB PM3 Card Through MPLAB IDE ..................................................... 87
9.4 MPLAB PM3 Card in Stand-alone Mode ...................................................... 97
DS51464C-page iv © 2006 Microchip Technology Inc.
Appendix A. Hardware Specifications
A.1 Introduction .................................................................................................. 99
A.2 Connecting to a PC via the Serial Port ........................................................ 99
A.3 Programmer Specifications ........................................................................ 100
A.4 ICSP Hardware Specifications ................................................................... 101
A.5 Socket Module Specifications .................................................................... 104
Appendix B. Troubleshooting
B.1 Introduction ................................................................................................ 107
B.2 Troubleshooting Hardware ......................................................................... 107
B.3 Troubleshooting Operational Problems ..................................................... 108
B.4 Troubleshooting Software .......................................................................... 108
B.5 Common Problems .................................................................................... 110
B.6 Error Messages – PC ................................................................................. 113
B.7 Error Messages – LCD .............................................................................. 114
B.8 Limitations .................................................................................................. 116
Glossary ..................................................................................................................... 117
Index ........................................................................................................................... 131
Worldwide Sales and Service .................................................................................. 134
© 2006 Microchip Technology Inc. DS51464C-page v
MPLAB® PM3 User’s Guide
NOTES:
DS51464C-page vi © 2006 Microchip Technology Inc.
MPLAB® PM3
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 Select the Help menu, and then Topics to open a list of available on-line help files.
INTRODUCTION
®
IDE on-line help.
This chapter contains general information that will be useful to know before using MPLAB PM3. Items discussed include:
• Document Layout
• Conventions Used in this Guide
• Warranty Registration
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
• Customer Support
© 2006 Microchip Technology Inc. DS51464C-page 1
MPLAB® PM3 User’s Guide
DOCUMENT LAYOUT
This document describes how to use MPLAB PM3 as a development tool to emulate and debug firmware on a target board. The manual layout is as follows:
Chapter 1. MPLAB PM3 Overview – Describes MPLAB PM3 and how it works.
Chapter 2. Installing MPLAB PM3 – Describes how to install MPLAB PM3
hardware and MPLAB software. Explains how to set up MPLAB IDE and MPLAB PM3 to work together and how to start MPLAB PM3 from MPLAB.
Chapter 3. Tutorial– Contains several examples (tutorials) for programming
calibration memory devices, memory devices and other PICmicro
Chapter 4. Using MPLAB PM3 with MPLAB IDE – Provides step-by-step
instructions on using MPLAB PM3 with MPLAB IDE to program, read and verify devices.
Chapter 5. Using MPLAB PM3 in Stand-Alone Mode – Provides instructions for
using MPLAB PM3 in Stand-Alone mode.
Chapter 6. Using the MPLAB PM3 Card – Provides instructions for using the
MPLAB PM3 Card.
Chapter 7. MPLAB PM3 – MPLAB IDE Reference – Describes the commands
available through the MPLAB PM3 command line interface as well as error messages.
Chapter 8. Stand-Alone Reference – Describes the commands available
through the MPLAB PM3 LCD.
• Chapter 9. MPLAB PM3 Card Reference – Describes the commands available
specifically for the MPLAB PM3 Card.
Appendix A. Hardware Specifications – Describes how to connect MPLAB
PM3 to a communication port. Provides instructions on cleaning MPLAB PM3 socket modules.
Appendix B. Troubleshooting – Provides information on solving common
problems.
®
MCU devices.
DS51464C-page 2 © 2006 Microchip Technology Inc.
CONVENTIONS USED IN THIS GUIDE
This manual uses the following documentation conventions:

DOCUMENTATION CONVENTIONS

Description Represents Examples
Arial font:
Italic characters Referenced books MPLAB
Initial caps A window the Output window
Quotes A field name in a window or
Underlined, italic text with right angle bracket
Bold characters A dialog button Click OK
N‘Rnnnn A number in verilog format,
Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>
Courier New font:
Plain Courier New Sample source code #define START
Italic Courier New A variable argument file.o, where file can be
Square brackets [ ] Optional arguments mcc18 [options] file
Curly brackets and pipe character: { | }
Ellipses... Replaces repeated text var_name [,
Preface
®
IDE User’s Guide
Emphasized text ...is the only compiler...
A dialog the Settings dialog A menu selection select Enable Programmer
“Save project before build”
dialog A menu path File>Save
A tab Click the Power tab
4‘b0010, 2‘hF1 where N is the total number of digits, R is the radix and n is a digit.
Filenames autoexec.bat File paths c:\mcc18\h Keywords _asm, _endasm, static Command-line options -Opa+, -Opa- Bit values 0, 1 Constants 0xFF, ‘A’
any valid filename
[options]
Choice of mutually exclusive arguments; an OR selection
Represents code supplied by user
errorlevel {0|1}
var_name...]
void main (void)
{ ...
}
© 2006 Microchip Technology Inc. DS51464C-page 3
MPLAB® PM3 User’s Guide
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 the MPLAB PM3 programmer. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources.
README for MPLAB PM3
For the latest information on using MPLAB PM3, read the
Readme for MPLAB PM3.txt file (an ASCII text file) in the MPLAB IDE\readmes direc-
tory. The README file contains update information and known issues that may not be included in this on-line help file.
MPLAB PM3 On-line Help
®
MPLAB
Describes how to set up the MPLAB IDE software and use it to create projects and program devices.
IDE Quick Start Guide (DS51281)
MPLAB® IDE User’s Guide (DS51519)
Comprehensive guide that describes installation and features of Microchip’s MPLAB Integrated Development Environment (IDE).
MPASM™ Assembler, MPLINK™ Object Linker, MPLIB™ Object Librarian User’s Guide (DS33014)
Describes how to use the Microchip PICmicro MCU assembler (MPASM assembler), linker (MPLINK linker) and librarian (MPLIB librarian).
MPLAB IDE On-line Help
In-Circuit Serial Programming™ (ICSP™) Guide (DS30277)
This document contains helpful design guidelines for successful ICSP programming. It includes application notes on hardware designs and the ICSP programming specifications.
DS51464C-page 4 © 2006 Microchip Technology Inc.
Preface
THE MICROCHIP WEB SITE
Microchip provides on-line support via our web 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 (FAQs), technical
support requests, on-line 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
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 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
Integrated Development Environment for development systems tools. This list is focused on MPLAB IDE, MPLAB SIM simulator, 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 and PICkit
®
IDE – The latest information on Microchip MPLAB IDE, the Windows®
®
1 development programmers.
II device programmers and the PICSTART®
© 2006 Microchip Technology Inc. DS51464C-page 5
MPLAB® PM3 User’s Guide
CUSTOMER SUPPORT
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• 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 offices and locations is included in the back of this document.
Technical support is available through the web site at: http://support.microchip.com
DS51464C-page 6 © 2006 Microchip Technology Inc.

Chapter 1. MPLAB PM3 Overview

1.1 INTRODUCTION

This chapter presents an overview of the features and requirements of MPLAB PM3. Topics covered in this chapter:
• What is MPLAB PM3?
• What MPLAB PM3 Does
• MPLAB PM3 System Components
• MPLAB PM3 CE Compliance
• How MPLAB PM3 Helps You
• MPLAB PM3 Operating with a PC
• MPLAB PM3 Operating without a PC (Stand-alone)
• MPLAB Integrated Development Environment
• MPLAB Development Tools

1.2 WHAT IS MPLAB PM3?

MPLAB® PM3
USER’S GUIDE
MPLAB PM3 is a Microchip microcontroller device programmer. Through interchangeable programming socket modules, MPLAB PM3 enables you to quickly and easily program the entire line of Microchip microcontroller devices.
MPLAB PM3 may be used with MPLAB IDE running under supported Windows Oper­ating Systems (OS's) (see “Readme for MPLAB PM3.txt” file for support list) or as a stand-alone programmer.
See “Recommended Reading” in the “Preface” for more information.

1.3 WHAT MPLAB PM3 DOES

MPLAB PM3 can be set up on the serial (COM 1-4) or USB communications port on your PC. With MPLAB PM3 you can perform the following operations:
• Program memory, Configuration bits, EEPROM data memory, ID locations and calibration data into devices.
• Program devices using ICSP™ (In-Circuit Serial Programming™) on the target board and user GO
• Verify that microcontrollers are blank.
• Verify that code in the target microcontroller matches your firmware.
• Read code from an unprotected microcontroller into MPLAB IDE’s program memory window for debugging and programming into other devices.
• Program unique serialized ID numbers into your firmware using Serial Quick Turn Programming (SQTP
• Store environments on an MPLAB PM3 Card.
, PASS and FAIL signals to interface with MPLAB PM3.
SM
) files.
© 2006 Microchip Technology Inc. DS51464C-page 7
MPLAB® PM3 User’s Guide

1.4 MPLAB PM3 SYSTEM COMPONENTS

The MPLAB PM3 device programmer system consists of the following:
• MPLAB PM3 device programmer (see Figure 1-1)
• Module sockets
Note: A complete line of socket modules is available. The socket modules may
be ordered separately for the devices that will be programmed.
• RS-232 Interface cable to connect to any standard PC serial port
• USB Interface cable to connect to any standard PC USB port
•ICSP cable
• Power supply
• MPLAB IDE software – an Integrated Development Environment including a text editor, project manager and simulator for debugging. Also included are the MPASM assembler, MPLINK object linker and MPLIB object librarian.
FIGURE 1-1: MPLAB

1.5 MPLAB PM3 CE COMPLIANCE

The MPLAB PM3 device programmer 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).
®
PM3 DEVICE PROGRAMMER
DS51464C-page 8 © 2006 Microchip Technology Inc.
MPLAB PM3 Overview

1.6 HOW MPLAB PM3 HELPS YOU

With the MPLAB PM3 device programmer, you can program Microchip devices from a PC Host, or you can use the device programmer as a stand-alone unit.
• MPLAB PM3 is easy to use and flexible in programming Microchip devices and package types.
• MPLAB PM3 will expand to support future Microchip devices always providing the latest programming algorithms to support Microchip PIC and other Microchip parts, via the Microchip web site (http://www.microchip.com).
• With an optional MPLAB PM3 Card inserted, you can store and transport device settings for programming.

1.7 MPLAB PM3 OPERATING WITH A PC

Using MPLAB Integrated Development System (IDE) as the interface, MPLAB PM3 becomes another tool in MPLAB IDE, allowing you to quickly compile, test and debug your firmware, then download it into MPLAB PM3 to be programmed into your device.

1.8 MPLAB PM3 OPERATING WITHOUT A PC (STAND-ALONE)

Without a PC connection to MPLAB PM3, the unit operates as a stand-alone device programmer. However, a PC connection is required for operating system updates. The main programmer features of MPLAB PM3 are available, including Read, Program and Verify.
®
microcontroller devices

1.9 MPLAB INTEGRATED DEVELOPMENT ENVIRONMENT

The MPLAB IDE desktop provides an environment for developing and debugging your application. MPLAB PM3 is integrated into MPLAB IDE, but you do not need MPLAB IDE to use MPLAB PM3.
This document covers the basic setup and operation of the MPLAB PM3 device programmer, but it does not cover all functions of MPLAB IDE. Read the MPLAB IDE documentation to get a full understanding of the features and debug capabilities of MPLAB IDE.
© 2006 Microchip Technology Inc. DS51464C-page 9
MPLAB® PM3 User’s Guide

1.10 MPLAB DEVELOPMENT TOOLS

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 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 MPLAB IDE. MPLINK linker creates the final application by linking relocatable modules from MPASM assembler, MPLAB C17 and MPLAB C18. MPLIB librarian manages custom libraries for maximum code reuse.
MPLAB C18 and MPLAB C30 C Compilers
The 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 and PICSTART Plus 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 MPLAB IDE.
Third Party Tools
Many other companies have development tools for Microchip products that work with MPLAB IDE. Consult the Microchip web site for additional information.
DS51464C-page 10 © 2006 Microchip Technology Inc.

Chapter 2. Installing MPLAB PM3

2.1 INTRODUCTION

This chapter describes how to install MPLAB PM3 hardware and software. Topics covered in this chapter include:
• Installing MPLAB PM3 Software
• Installing MPLAB PM3 Hardware
• Powering Up MPLAB PM3
• Configuring MPLAB IDE for Use with MPLAB PM3
2.2 INSTALLING MPLAB PM3 SOFTWARE
MPLAB PM3 hardware requires the following software support if you are using a PC running Windows:
• MPLAB IDE software
Note: There are alternative command-line programs for MPLAB PM3 control,
also installed with MPLAB IDE, named PM3CMD and Visual PROCMD.
MPLAB® PM3
USER’S GUIDE
• USB communications driver

2.2.1 MPLAB IDE Software Installation

The MPLAB IDE software should be installed by following the instructions in the “MPLAB discussed next.
• For a CD-ROM:
• For the Microchip Website:
®
IDE Quick Start Guide” (DS51281). A brief summary of this procedure is
- Insert the MPLAB IDE CD into the CD-ROM drive.
- Follow the on-screen instructions to install the MPLAB IDE software.
- Go to www.microchip.com and follow the links to the Development Tools
page.
- Click the links to the latest MPLAB IDE release and download.
© 2006 Microchip Technology Inc. DS51464C-page 11
MPLAB® PM3 User’s Guide

2.2.2 USB Driver Installation

Do not allow the Windows OS to pick a USB driver. MPLAB PM3 will not work with this driver. You must follow the procedure specified at MPLAB IDE software installa­tion to set up the USB driver or to fix an improper driver installation.
Install MPLAB IDE first. The USB driver installation instructions will pop up at the end of MPLAB IDE installation. Follow those instructions to install the USB driver.
The instructions are in the MPLAB IDE installation directory under:
MPLAB PM3\Drivers\instr.htm
where instr.htm depends on your Personal Computer (PC) OS:
• ddpm398.htm – Windows 98
• ddpm3me.htm – Windows ME
• ddpm3.htm – Windows 2000/XP

2.3 INSTALLING MPLAB PM3 HARDWARE

IMPORTANT: Do not allow the Windows OS to pick a USB driver. Follow the procedure
specified in Section 2.2.2 “USB Driver Installation”.
The MPLAB PM3 hardware is simple to set up:
• If you are using MPLAB IDE:
- Attach the communications cable.
- Connect the power supply to MPLAB PM3.
- Install the socket module (or attach the ICSP cable).
• If you are using MPLAB PM3 in Stand-Alone mode:
- Connect the power supply to MPLAB PM3.
- Install the socket module or attach the ICSP cable.
• If you are using the MPLAB PM3 Card in MPLAB PM3:
- Insert the MPLAB PM3 Card into the SD-MMC port on the back of the programmer.
NOTICE
2.3.1 Installing the Communications Cable
MPLAB PM3 provides communications with the host PC via an RS-232 9-pin D type connector or a USB connector. See Figure 2-1 for communication port locations.
MPLAB PM3 is supplied with two 6-foot data cables: one with DB-9 connectors and one with USB connectors. All lines on the serial cable are wired straight through. The serial cable is NOT a null modem cable.
FIGURE 2-1: BACK VIEW OF MPLAB
Power On
Power Input
PWR
DS51464C-page 12 © 2006 Microchip Technology Inc.
Power Off
USB Port
I
O
USB
®
RS-232
PM3
Serial Port
Secure Digital/
Multi-Media Card Port
SD-MMC
Installing MPLAB PM3

2.3.1.1 FOR USB COMMUNICATIONS

• Connect one end of the USB cable to a USB port on your PC.
• Connect the cable from the PC USB port to the corresponding USB connector on
the back of MPLAB PM3.
Note: If you are using USB and a “New Hardware Detected” notice appears on
your PC, you must follow the directions on installing the proper driver or your MPLAB PM3 will not work.

2.3.1.2 FOR RS-232 COMMUNICATIONS

NOTICE
IMPORTANT: Set the COM port FIFO buffers off, the Flow Control to “Hardware” and Baud Rate to 57600. You will need to reboot your PC for these settings to take effect. See Section B.5.2.5 “Manually Setting Up The Port” for more information.
• Connect one end of the RS-232 cable to an available COM port on your PC.
Check your PC setup to see which communications port is available.
• Connect the cable from the PC COM port to corresponding RS-232 connector on
the back of MPLAB PM3. For more on serial connections, see
Section A.2 “Connecting to a PC via the Serial Port”.
2.3.2 Installing the Power Supply
MPLAB PM3 comes with a proprietary external power supply.
1. Make sure that the power switch on the back of the unit is in the OFF position
(see Figure 2-1).
2. Plug the power supply into a power socket and connect the power supply cable
to the unit.
© 2006 Microchip Technology Inc. DS51464C-page 13
MPLAB® PM3 User’s Guide
2.3.3 Installing a Socket Module or ICSP Cable
Socket modules are sold separately. MPLAB PM3 comes with an 18-inch ICSP cable for ICSP programming. See Figure 2-2 for location of socket module connectors and ICSP connector.
FIGURE 2-2: TOP VIEW OF MPLAB
®
PM3
MPLAB® PM3
Device Programmer
LCD
LEDs
STATUS
POWER
ESC ENTER
Keys/Buttons
M

2.3.3.1 SOCKET MODULE INSTALLATION

Socket modules are available to accommodate each device package. The “Product Selector Guide” (DS00148) lists Microchip’s devices, tools and socket modules. The “Development System Ordering Guide” (DS30177) describes the available socket modules. Also, the Readme for MPLAB PM3 file lists socket module support for each device.
ICSP Connector
Socket Module Connectors
Note: MPLAB PM3 allows hot swapping of socket modules. If the status LED is
not lit, sockets can be replaced.
2.3.3.1.1 For MPLAB PM3 Socket Modules
1. Align the connectors on the socket module with the connectors on MPLAB PM3 (Figure 2-2).
2. Push the socket module down evenly mating the connectors.
It is always a good practice to insert a known blank device and do a Blank Check whenever the socket module is changed.
2.3.3.1.2 For PRO MATE II Socket Modules
Note 1: In order to use PRO MATE II socket modules with MPLAB PM3, you must
obtain an AC164350 adapter kit. See the “Development System Ordering Guide” (DS30177).
2: The PRO MATE II ICSP socket module is not supported by MPLAB PM3.
An 18-inch ICSP cable is included with MPLAB PM3, eliminating the need for an ICSP socket.
DS51464C-page 14 © 2006 Microchip Technology Inc.
Installing MPLAB PM3
1. Align the connectors on the adapter with the connectors on MPLAB PM3.
2. Push the adapter down evenly mating the connectors.
3. Align the socket module with the adapter on MPLAB PM3.
4. Tighten the two socket module thumb screws evenly and simultaneously. Avoid
over tightening; they should be finger-tight only.
Note: The gold connector strips on the PRO MATE II socket module are relatively
fragile. Avoid touching them with the socket module screws and avoid over-tightening the screws.
It is always a good practice to insert a known blank device and do a Blank Check whenever the socket module it changed.

2.3.3.2 ICSP CABLE INSTALLATION

1. Connect the ICSP cable connector to the ICSP socket on MPLAB PM3
(Figure 2-2).
2. Leave the individual leads unconnected at this time.

2.3.3.3 MPLAB PM3 CARD INSERTION

1. Align the MPLAB PM3 Card with the SD-MMC slot on the back of the
MPLAB PM3 programmer, and insert the notched corner end of the card into the slot. The card is keyed so that it only goes in one way.
2. Push the card into the slot.
3. To remove the card, push in to eject.

2.4 POWERING UP MPLAB PM3

Once you have connected the hardware and installed the software, you are ready to turn on MPLAB PM3. Turn the power switch on the side of MPLAB PM3 to l (ON) (refer back to Figure 2-1).
Note: MPLAB PM3 automatically performs a self-test ensuring the programmer is
functional. No calibration is required.
If any portion of the self-test fails, MPLAB PM3 will display the corrective course of action on the LCD panel. For normal start-up, the MPLAB PM3 will beep once. See Section B.7 “Error Messages – LCD” for information on beep codes and LCD error messages. MPLAB IDE will provide further information to help you debug the issue.
On a successful power-up, you should see the following types of messages appear on the LCD panel on the front of MPLAB PM3:
• MPLAB PM3 splash screen
• Version numbers and copyright dates
• MPLAB PM3 menu
At this point, you are ready to use MPLAB PM3. If you are going to use MPLAB PM3 with MPLAB IDE (Windows), please refer to Chapter 4. “Using MPLAB PM3 with MPLAB IDE”. If you are going to use MPLAB PM3 in Stand-Alone mode, please refer to Chapter 5. “Using MPLAB PM3 in Stand-Alone Mode”. If you are using the MPLAB PM3 Card with either MPLAB IDE or in Stand-Alone mode, also refer to
Chapter 6. “Using the MPLAB PM3 Card”
© 2006 Microchip Technology Inc. DS51464C-page 15
MPLAB® PM3 User’s Guide
2.4.1 Indicator Lights and Buzzer
Two indicator lights (LEDs) are located on the front of the programmer. A buzzer, for audio indication, is incorporated into the programmer as well.

TABLE 2-1: STATUS LED INDICATIONS

LED Condition
Red Booting up, Programming Failed, Other Error
Orange Working/Busy
Green Programming Passed

TABLE 2-2: POWER LED

LED Condition
On Programmer powered
Off Programmer not powered
2.4.2 Powering Down MPLAB PM3
Turn the power switch on the back of MPLAB PM3 to “OFF”.

2.5 CONFIGURING MPLAB IDE FOR USE WITH MPLAB PM3

2.5.1 Starting MPLAB IDE

Once MPLAB IDE is installed on your PC, from the Start menu, select All Programs> Microchip MPLAB IDE>MPLAB IDE.
The MPLAB IDE desktop should look similar to Figure 2-3.
FIGURE 2-3: MPLAB
®
IDE DESKTOP
DS51464C-page 16 © 2006 Microchip Technology Inc.
Installing MPLAB PM3
2.5.2 Selecting MPLAB PM3 as the Programmer
In addition to MPLAB PM3, the PRO MATE II and PICSTART Plus device programmers are supported under MPLAB IDE. However, only one programmer can be used at a time.
Select Programmer>Select Programmer>MPLAB PM3 list of available programmers (Figure 2-4). After MPLAB PM3 is selected:
• The Programmer menu changes to include the MPLAB PM3 Programmer Menu
and Settings.
• The MPLAB PM3 Toolbar is revealed.
• The name of the programmer appears on the status bar.
FIGURE 2-4: SELECT PROGRAMMER MENU
to select MPLAB PM3 from the
© 2006 Microchip Technology Inc. DS51464C-page 17
MPLAB® PM3 User’s Guide
2.5.3 Setting Up the Communications Port
You can set up MPLAB PM3 to communicate with MPLAB IDE through one of the serial COM ports (1-4) or USB.
2.5.3.1 SERIAL COMMUNICATIONS
From the MPLAB Programmer menu, select Programmer>Settings
Communications tab. A dialog similar to the one shown in Figure 2-5 will display.
FIGURE 2-5: COMMUNICATIONS PORT SETUP DIALOG
and click on the
The Communications Port Setup dialog shows the possible PC serial and USB communication ports. Click OK to set the options or Cancel to ignore the changes and close the dialog.
DS51464C-page 18 © 2006 Microchip Technology Inc.
Installing MPLAB PM3
2.5.3.2 USB COMMUNICATIONS
To use USB communications between the PC and the MPLAB PM3 device programmer, select the
Do not allow the Windows OS to pick a USB driver; it will not work and you will then not be able to install the proper driver. Follow the procedure specified in Section 2.2 “Installing MPLAB PM3 Software”.
FIGURE 2-6: USB PORT
USB port (Figure 2-6). Click OK.
CAUTION
To make sure the port is set up properly, follow the instructions in the “For USB Communications” subsection in Section 2.3.1 “Installing the Communications Cable”.
© 2006 Microchip Technology Inc. DS51464C-page 19
MPLAB® PM3 User’s Guide
2.5.4 Selecting a Device in MPLAB IDE
Chose Configure>Select Device to select the device you wish to program from the list of available devices (Figure 2-7). 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 (advance) support
• Red – no support.
If the selected device is supported by MPLAB PM3, click OK.
FIGURE 2-7: SELECT DEVICE DIALOG
2.5.5 Enabling MPLAB PM3
To enable MPLAB PM3, select Programmer>Enable Programmer (Figure 2-8). The MPLAB PM3 toolbar will appear when the programmer is enabled. See Chapter
7. “MPLAB PM3 – MPLAB IDE Reference” for more reference information on the
MPLAB PM3 programmer. The MPLAB PM3 Card is available from the Programmer menu only if you have the MPLAB PM3 Card inserted in the MPLAB PM3 programmer.
MPLAB IDE may warn you that your programmer OS Suite is out of date. If you choose, MPLAB IDE will automatically update the necessary files at these warnings.
FIGURE 2-8: ENABLE PROGRAMMER
DS51464C-page 20 © 2006 Microchip Technology Inc.
Installing MPLAB PM3
If MPLAB PM3 is not found on the selected port, the Communications Error dialog (Figure 2-9) will appear.
FIGURE 2-9: COMMUNICATIONS ERROR DIALOG
If you cannot establish communications between the PC and MPLAB PM3, please make sure you have installed the hardware and software correctly. If you still cannot establish communications between the PC and MPLAB PM3, refer to Appendix B. “Troubleshooting”.
If you have been using another programmer (e.g., PICSTART Plus), the MPLAB PM3 menu may be unavailable. From the Programmer menu, select Programmer> Select Programmer to bring up the Select Programmer dialog and choose MPLAB PM3 from the list. The MPLAB PM3 menu will appear on the menu bar.
2.5.6 Inserting a Device into MPLAB PM3
If you are using a socket module, insert the device to be programmed into the MPLAB PM3 socket. Position pin one to be top justified in the socket. Secure the device by pushing down the silver lever on the socket or closing the clamshell.
© 2006 Microchip Technology Inc. DS51464C-page 21
MPLAB® PM3 User’s Guide
NOTES:
DS51464C-page 22 © 2006 Microchip Technology Inc.

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.2 “Installing MPLAB PM3
Software”.
2. Install the MPLAB PM3 hardware. See Section 2.3 “Installing MPLAB PM3
Hardware”.
3. Make sure you have read and completed all the instructions in
Section 2.4 “Powering Up MPLAB PM3” and Section 2.5 “Configuring MPLAB IDE for Use with MPLAB PM3”.
4. Make sure that your PC and MPLAB PM3 are communicating and the
MPLAB PM3 menu appears on the MPLAB IDE menu before you begin this tutorial.
MPLAB® PM3
USER’S GUIDE

Chapter 3. Tutorial

3.3 PROGRAMMING OVERVIEW

Programming a 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 MPLAB PM3
• Programming the Device
• Verifying the Programming
© 2006 Microchip Technology Inc. DS51464C-page 23
MPLAB® PM3 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 MPLAB PM3. Click OK.

FIGURE 3-1: SELECTING THE DEVICE

3.5 CREATING THE PROJECT

to open the Select Device dialog (Figure 3-1) and select the
In order to program the device, you’ll need a hex file. In this example, we’ll create a project using the Project Wizard. We will use a single assembly file for this project and a linker script. Choose the Project>Project Wizard

FIGURE 3-2: PROJECT WIZARD WELCOME SCREEN

.
Click on Next> to advance to the next dialog in the Project Wizard.
DS51464C-page 24 © 2006 Microchip Technology Inc.
Loading...
+ 110 hidden pages