Microchip ICD2 user guide: MPLAB ICD 2 Overview

Published by Microchip · pages 25–48 of 148 · Original PDF

75 discussions about the Microchip ICD2

All 5 parts of the user guide

MPLAB ICD 2 Overview

  • No diodes on PGC/PGD – they will prevent bidirectional communication between MPLAB ICD 2 and the target PIC MCU.

1.4.4 Debug Mode

There are two steps to using MPLAB ICD 2 as a debugger. The first requires that an application be programmed into the target PIC MCU. The second uses the internal in-circuit debug hardware of the target Flash PIC MCU to run and test the application program. These two steps are directly related to the MPLAB IDE operations:

  1. Programming the code into the target.
  2. Using the debugger to set breakpoints and run.

If the target PIC MCU cannot be programmed correctly, MPLAB ICD 2 will not be able to debug.

Figure 1-4 shows the basic interconnections required for programming. Note that this is the same as Figure 1-2, but for the sake of clarity, the VDD and Vss lines from MPLAB ICD 2 are not shown.

FIGURE 1-4: PROPER CONNECTIONS FOR PROGRAMMING

Figure from the manual

A simplified diagram of some of the internal interface circuitry of the MPLAB ICD 2 is shown. For programming, no clock is needed on the target PIC MCU, but power must be supplied. When programming, MPLAB ICD 2 puts programming levels on VPP, sends clock pulses on PGC and serial data via PGD. To verify that the part has been programmed correctly, clocks are sent to PGC and data is read back from PGD. This conforms to the ICSP protocol of the PIC MCU under development.

1.4.5 Requirements For Debug Mode

To debug (set breakpoints, see registers, etc.) with the MPLAB ICD 2 there are critical elements that must be working correctly:

  • MPLAB ICD 2 must be connected to a PC. It must be powered by an external power supply or the PC via the USB cable, and it must be communicating with MPLAB IDE software via the RS-232 or USB cable. See the on-line help for details.
  • The MPLAB ICD 2 must be connected as shown to the VPP, PGC and PGD pins of the target PIC MCU with the modular interface cable (or equivalent). VSS and VDD are also required to be connected between the MPLAB ICD 2 and target PIC MCU.
  • The target PIC MCU must have power and a functional, running oscillator. If the target PIC MCU does not run – for whatever reason – MPLAB ICD 2 cannot debug.
  • The target PIC MCU must have its configuration words programmed correctly:
    • The oscillator Configuration bits should correspond to RC, XT, etc., depending upon the target design.
    • The target PIC MCU must not have the Watchdog Timer enabled.
    • The target must not have code protection enabled.
    • The target must not have table read protection enabled.

MPLAB ICD 2 Overview

Once the above conditions are met, you may proceed to the following:

• Sequence of Operations Leading to Debug Mode

• Debug Mode Details

1.4.5.1 SEQUENCE OF OPERATIONS LEADING TO DEBUG MODE

Given that the Requirements For Debug Mode are met, these actions can be performed when MPLAB ICD 2 is set as the current debugger (Debugger>Select Tool):

• When Debugger>Program is selected, the application code is programmed into the PIC MCU's memory via the ICSP protocol as described above.

• A small "debug executive" program is loaded into the high area of program memory of the target PIC MCU. Since the debug executive must reside in program memory, the application program must not use this reserved space. The debug executive typically needs about 0x120 words of program memory.

• Special "in-circuit debug" registers in the target PIC MCU are enabled. These allow the debug executive to be activated by the MPLAB ICD 2.

• The target PIC MCU is held in reset by keeping the VPP/MCLR line low.

1.4.5.2 DEBUG MODE DETAILS

Figure 1-5 illustrates the MPLAB ICD 2 ready for debugging.

FIGURE 1-5: MPLAB® ICD 2 READY FOR DEBUGGING

Figure from the manual

Typically, in order to find out if an application program will run correctly, a breakpoint is set early in the program code. When a breakpoint is set from the user interface of the MPLAB IDE, the address of the breakpoint is stored into the special internal debug registers of the target PIC MCU. Commands on PGC and PGD communicate directly to these registers to set the breakpoint address.

Next, the Debugger>Run function or the Run icon (forward arrow) is usually pressed from MPLAB IDE. MPLAB ICD 2 will raise the VPP/MCLR line to allow the target to run, the target will start from address zero and execute until the program counter reaches the breakpoint address previously stored in the internal debug registers.

MPLAB ICD 2 Overview

After the instruction at the breakpoint address is executed, the in-circuit debug mechanism of the target PIC MCU “fires” and transfers the PIC MCU’s program counter to the debug executive (much like an interrupt) and the user’s application is effectively halted. MPLAB ICD 2 communicates with the debug executive via PGC and PGD, gets the breakpoint status information and sends it back to the MPLAB IDE. The MPLAB IDE then sends a series of queries to MPLAB ICD 2 to get information about the target PIC MCU, such as file register contents and the state of the CPU. These queries are ultimately performed by the debug executive.

The debug executive runs just like an application in program memory. It uses some locations on the hardware stack (usually just one or two) and, typically, about fourteen file registers for its temporary variables. If the PIC MCU does not run, for whatever reason, such as no oscillator, a faulty power supply connection, shorts on the target board, etc., then the debug executive cannot communicate to MPLAB ICD 2 and MPLAB IDE will issue an error message.

Another way to get a breakpoint is to press the MPLAB IDE’s Halt button (the “pause” symbol to the right of the Run arrow). This toggles the PGC and PGD lines in such a way that the in-circuit debug mechanism of the target PIC MCU switches the program counter from the user’s code in program memory to the debug executive. Again, the target application program is effectively halted, and MPLAB IDE uses MPLAB ICD 2 communications with the debug executive to interrogate the state of the target PIC MCU.

1.4.6 Debug Reserved Resources

When developing with MPLAB ICD 2, you must be aware of the device resources reserved for debugging. See Section 1.5 “Resources Used By MPLAB ICD 2” for a list of reserved resources by device type.

1.4.7 Programmer Mode

When using the Programmer>Program selection to program a device, the in-circuit debug registers should be disabled in the MPLAB IDE so the MPLAB ICD 2 will program only the target application code and the Configuration bits (and EEPROM data, if available and selected) into the target PIC MCU. The debug executive will not be loaded. In this mode the MPLAB ICD 2 can only toggle the MCLR line to reset and start the target. A breakpoint cannot be set, and register contents cannot be seen or altered.

The MPLAB ICD 2 programs the target using ICSP. No clock is required while programming, and all modes of the processor can be programmed, including code-protect, Watchdog Timer enabled and table read protect.

Note: A header board is required to debug smaller pin count parts with the MPLAB ICD 2. These parts can be programmed without the header by connecting the VPP, PGC and PGD lines as described previously.

1.5 RESOURCES USED BY MPLAB ICD 2

Refer the MPLAB ICD 2 on-line help for up-to-date information on reserved resources.

DS51331C-page 24 © 2007 Microchip Technology

ICD2PDF.book Page 25 Friday, November 9, 2007 3:21 PM

MICROCHIP

MPLAB® ICD 2

USER’S GUIDE

Chapter 2. Getting Started

2.1 INTRODUCTION

The use of MPLAB ICD 2 with MPLAB IDE software and an explanation of power options and recommended power-up sequences are discussed here. Following this is a step-by-step tutorial using MPLAB ICD 2. Before continuing on to the tutorial, be sure that the software and hardware is configured according to the instructions given here.

In addition, please refer to the “MPLAB ICD 2 Design Advisory” (DS51566) for hardware configuration issues.

Topics covered in this chapter:

  • MPLAB ICD 2 System Components
  • Installing and Configuring MPLAB IDE for MPLAB ICD 2
  • Applying Power
  • Connection Options
  • Setting Up the Environment
  • MPLAB ICD 2 Development Process

2.2 MPLAB ICD 2 SYSTEM COMPONENTS

In addition to the MPLAB ICD 2 module, the following components are required:

• MPLAB IDE software (version 6.20 or later) – Installed on the PC to control MPLAB ICD 2.

• RS-232 or USB cable – To connect the MPLAB ICD 2 module to a COM or USB port on the PC.

Note: Do not connect the USB cable until installation of the MPLAB IDE software and instructions for configuring the USB driver have been completed.

• Modular interface cable – To connect the MPLAB ICD 2 module to a header board, demo board or the target application.

Note: Although the serial or USB communications from MPLAB IDE to the MPLAB ICD 2 can be set up without a target connection, MPLAB ICD 2 will not function as a debugger without being connected to a target.

• Header board (optional) – If an ICD device is used, a header board will be required to connect the device with on-board debug capabilities to the modular interface (and the MPLAB ICD 2). The header may then be plugged into a demo board or the target application. See Section 4.6 “ICD/ICE Devices”.

• Demo board or target application – To connect the device with on-board debug capabilities to the modular interface (and the MPLAB ICD 2).

• Power adapter(s) – To power MPLAB ICD 2 and the target application.

Getting Started

2.3 INSTALLING AND CONFIGURING MPLAB IDE FOR MPLAB ICD 2

Note: When using the USB cable, do not connect it before installing MPLAB IDE software.

To install the MPLAB IDE software, first acquire the latest MPLAB IDE installation executable (MPxxxxx.exe, where xxxxx represents the version of MPLAB IDE) from either the Microchip web site (www.microchip.com) or the MPLAB IDE CD-ROM (DS51123).

  • Setting Up Communications
  • Starting MPLAB IDE
  • Select the Device
  • Set MPLAB ICD 2 as the Debug Tool
  • Configure the Interface
2.3.1 Setting Up Communications

MPLAB ICD 2 can communicate with the PC serially or using USB.

Note: Do not connect both RS-232 and USB cables to MPLAB ICD 2.

2.3.1.1 SERIAL COMMUNICATIONS

If using the RS-232 cable, connect it to the MPLAB ICD 2 and the PC. The Flow Control and FIFO settings must be set properly for a serial communications port on a PC with a Windows operating system. See Section 8.3.1.3 “Changing Serial Port Settings” for instructions.

2.3.1.2 USB COMMUNICATIONS

Instructions are supplied with MPLAB IDE to install the USB drivers. These instructions will pop up during MPLAB IDE installation. If you accidentally close these instructions, they may be found at: MPLAB IDE installation directory\ICD2\Drivers\Ddicd2nn.htm

where nn represents the version of Windows OS. If the instructions support more than one version, no OS version (nn) will be specified.

Note: If you change USB ports/hubs, you will need to reinstall the drivers.

2.3.2 Starting MPLAB IDE

After installing the MPLAB IDE software, invoke it by using any of these methods:

• Select Start>Programs>Microchip>MPLAB IDE vx.xx>MPLAB IDE, where vx.xx is the version number.

• Double click the MPLAB IDE desktop icon.

• Execute the file mplab.exe in the \core subdirectory of the MPLAB IDE installation directory. For more information on using the MPLAB IDE software, see:

  • “MPLAB® IDE User’s Guide” (DS51519) – Comprehensive guide for using MPLAB IDE.
  • “MPLAB® IDE Quick Start Guide” (DS51281) – Chapters 1 and 2 of the user’s guide.
  • The on-line help for MPLAB IDE – The most up-to-date information on MPLAB IDE.
  • The file Readme for MPLAB IDE.txt – Last-minute information on each release. Included in the MPLAB IDE installation directory.
  • Also see the file Readme for MPLAB ICD 2.txt for the most current information about MPLAB ICD 2.

Getting Started

After starting MPLAB IDE, it will need to be configured for MPLAB ICD 2 use:

  1. Select a device supported by MPLAB ICD 2.
  2. Set MPLAB ICD 2 as the current debugger.
  3. Configure the MPLAB ICD 2 RS-232 or USB interface.

2.3.3 Select the Device

Use the Device Selection dialog (Configure>Select Device) to select the device to be debugged with the MPLAB ICD 2. Devices fully supported by MPLAB ICD 2 will have a "green light" icon next to MPLAB ICD 2 under Microchip Tool Support. Devices with preliminary support will have a yellow light" icon. Devices not currently supported will have a "red light" icon.

2.3.4 Set MPLAB ICD 2 as the Debug Tool

Select Debugger>Select Tool>MPLAB ICD 2 to choose MPLAB ICD 2 as the debug tool. The Debugger menu and MPLAB IDE toolbar will change to display debug options once the tool is selected. Also, the Output window will open and messages concerning ICD status and communications will be displayed on the MPLAB ICD 2 tab.

Note: MPLAB ICD 2 may be selected as either a debug tool (Debugger Menu) or a programmer (Programmer menu). Do not select both.

2.3.5 Configure the Interface

Go to the Debugger>Settings, Communications tab to select the USB interface or the correct COM port for RS-232 communications.

2.4 APPLYING POWER

There are a number of configurations for powering MPLAB ICD 2 and the target. The following are configuration essentials:

• When using the USB connection, MPLAB ICD 2 can be powered from the PC but a power supply must be connected to the target.

• When using the RS-232 connection to the PC, MPLAB ICD 2 must have a power supply connected to it.

• When MPLAB ICD 2 has its own power supply, it can provide a limited amount of current, up to 200 mA, at five volts to a small target board.

• MPLAB ICD 2 cannot be powered from the target board.

• Power should be applied to MPLAB ICD 2 before applying power to the target.

There are two power-up sequences for the ICD:

• Power Sequence When MPLAB ICD 2 is Providing Power to the Target

• Power Sequence When Target Has a Separate Power Supply

2.4.1 Power Sequence When MPLAB ICD 2 is Providing Power to the Target

Use this sequence to power the target board from MPLAB ICD 2. This configuration allows up to 200 mA of current at 5 volts only.

  1. Apply power to MPLAB ICD 2. DO NOT power the target.

  2. Start MPLAB IDE.

  3. Under the Debugger menu of MPLAB IDE, select Connect.

  4. After establishing communications with the MPLAB ICD 2, select Debugger>Settings.

Getting Started

  1. In the Settings dialog, click the Power tab and ensure that the check box for “Power target circuit from MPLAB ICD 2” is checked. Click OK.

Note: If any of the self-tests on the Status tab of the Settings dialog do not pass, it may not be possible to erase and program chips. See Section 7.7 “Failed Self-Test Error – Vpp/Vdd High/Low” for more information.

2.4.2 Power Sequence When Target Has a Separate Power Supply

Use this sequence to power the target board from its own power supply. For this configuration, the target power can be 2-5 volts at higher currents than can be provided by the MPLAB ICD 2 (>200 mA). Check the PIC MCU data sheet to verify the operational voltage range for the device being used.

  1. Apply power to MPLAB ICD 2. DO NOT power the target.
  2. Start MPLAB IDE.
  3. Under the Debugger menu of MPLAB IDE, select Connect.
  4. After establishing communications with the MPLAB ICD 2, select Debugger>Settings.
  5. In the Settings dialog, click the Power tab and ensure that the check box for “Power target circuit from MPLAB ICD 2” is NOT checked. Click OK.
  6. Power the target system and then select Debugger>Connect.

Note: If any of the self tests on the Status tab of the Settings dialog do not pass, it may not be possible to erase and program chips. See Section 7.7 “Failed Self-Test Error – Vpp/Vdd High/Low” for more information.

2.5 CONNECTION OPTIONS

Once you have initially connected with the MPLAB ICD 2, you may continue to manually connect each time you select the ICD as a debugger (by using Debugger>Connect) or you may set the ICD to connect automatically (by checking “Automatically connect at start-up” on the Status tab of Debugger>Settings.)

On connection, for dsPIC® DSC devices, silicon version information will be displayed in the Output window.

2.6 SETTING UP THE ENVIRONMENT

This section provides a quick summary on MPLAB ICD 2 operation.

• Setting Debugging and Programming Options

• Creating and Building a Project

2.6.1 Setting Debugging and Programming Options

The easiest way to set up the MPLAB ICD 2 for operation is to use the MPLAB ICD 2 Setup Wizard (Debugger>MPLAB ICD 2 Setup Wizard.) Additionally, these dialogs allow you to set or reset debugging and programming options:

  • Configuration Bits dialog (Configure>Configuration Bits) – Select the Configuration bits on the PIC microcontroller. For complete details about these options, see the Special Features – Configuration Bits section of the data sheet for the device being programmed.

Note: Configuration bits can be specified in the source code instead of setting them in this dialog. When doing this, every time the project is rebuilt, the Configuration bits will get reset to the values specified in the source code.

Getting Started

  • ICD Settings dialog (Debugger>Settings or Programmer>Settings) – Set up communications, power, programming and warning message output, as well as view status, limitations, and version information.

You have previously used the Communications and Power tabs when setting up the MPLAB ICD 2 hardware. The following tabs are useful for completing the ICD setup. For detailed information on these and the other tabs on the Settings dialog, see Section 5.4 “Settings Dialog”.

  • Program tab – Set up programming options (Select Memories, Program and External Memory Ranges, ID, and Program Options, Erase All). If programming the ID bits is desired, set the value to be programmed in the Configure>ID Memory dialog.
  • Warning tab – Determine which warning messages will be displayed. Can be useful to select messages if they are to be outputted to a file (see Status tab.)
  • Status tab – In addition to auto-connect on startup and self-test control, output messages may be selected to be logged to a file. These messages may assist users or, if necessary, Microchip technical support in finding errors.

2.6.2 Creating and Building a Project

The easiest way to create a new project is to select Project>Project Wizard. With the help of the Project Wizard, a new project and the language tools for building that project can be created. The wizard will guide you through the process of adding source files, libraries, linker scripts, etc. to the various “nodes” on the project window. See MPLAB IDE documentation for detailed steps on using this wizard.

After the project is created, choose Project>Build All to build the application. This will create object code for the application that can be programmed into the target with MPLAB ICD 2.

2.7 MPLAB ICD 2 DEVELOPMENT PROCESS

The development process with MPLAB ICD 2 consists of these steps:

  1. Programming the Target Processor for Debugging.
  2. Debugging The Application.
  3. Modifying Target Application Code and Rebuilding the Hex File.
  4. Finishing the Application: Using MPLAB ICD 2 as a Programmer.
  5. Additional Programming Options.

2.7.1 Programming the Target Processor for Debugging

To program the application project's code into the MPLAB ICD 2 for debugging, follow these steps:

  1. Select Debugger>Settings and then click the Program tab to set the programming options for your application.
  2. Select Configure>Configuration Bits and set the oscillator and other Configuration bit settings appropriate to the target.
  3. Select Debugger>Program to download your code and debug executive to the device in the application or demo board that is connected to the MPLAB ICD 2. Download time will depend on the memory used (i.e., program memory, EEPROM), size of program, and voltage.

2.7.2 Debugging The Application

To debug your code, you must execute (run) it.

  • Real-Time Execution
  • Breakpoints
  • Step Mode Execution
  • Writing Data EEPROM

DS51331C-page 34

© 2007 Microchip Technology

Getting Started

2.7.2.1 REAL-TIME EXECUTION

Real-time execution occurs when the device in the demo/application board is put in MPLAB IDE's Run mode.

When the MPLAB ICD 2 is run in real time, instructions execute just as the processor would without the debugger. While in the Run mode, register displays on the screen will not update.

To execute the code in real-time:

  1. Open the source file (double click on the file name in the Project Window or use File>Open) or program memory window (View>Program Memory) for viewing.
  2. Select Debugger>Run (or click the toolbar Run button).

The processor will run until a breakpoint is reached or until the processor is halted by selecting Debugger>Halt (or clicking the toolbar Halt button).

2.7.2.2 BREAKPOINTS

Breakpoints allow you to specify conditional program halts so that you may observe memory, register or variable values after a runtime execution. You may set breakpoints in either the file (editor) window, the program memory window or the disassembly window.

You may set a breakpoint using either:

  • Right mouse button menu – click on the line in code at which you wish to set a breakpoint and select Set Breakpoint.
  • Breakpoint dialog – open the dialog and enter a breakpoint at a specific address

Note: For most devices, only one breakpoint will be set (active) at a time, although you may specify more than one breakpoint in the breakpoint dialog (i.e., one breakpoint will be active and the others will be inactive).

Breakpoints are a function of the MPLAB IDE and discussed in more detail in documentation for that tool.

Advanced breakpoints are a function of the MPLAB ICD 2. For more information, see Section 5.6 “Advanced Breakpoints Dialog”.

2.7.2.3 STEP MODE EXECUTION

Step mode execution can be accessed after the processor is halted.

Step Mode Execution occurs when you single step the processor or execute Debugger>Step Into. Step mode execution allows you to step through the code one instruction at a time, to watch the program flow, and to see the register contents at each instruction (as set in the dialog box).

Note: While single stepping, the MPLAB ICD 2 may not respond to interrupts. See limitations for your device to determine if it supports stepping into interrupts.

2.7.2.4 WRITING DATA EEPROM

If data EEPROM is written during program execution, the EEPROM window of MPLAB IDE will not reflect the changes. You will need to perform a READ of EEPROM memory in order to update the values in the window.

If some register or memory values do not seem correct in other windows, remember that MPLAB ICD 2 has reserved resources.

2.7.3 Modifying Target Application Code and Rebuilding the Hex File

To modify the code and rebuild the hex file:

  1. Open the source file (double click on the file name in the Project Window or use File>Open).
  2. Make the necessary changes to debug the code.
  3. Rebuild the hex file using Project>Build All.
  4. Select Debugger>Program to program the device with the updated hex file.

Getting Started

2.7.4 Finishing the Application: Using MPLAB ICD 2 as a Programmer

Once the code has been debugged and the application is running as designed, the device can be programmed without the debugger enabled. The device resources reserved for ICD operation then will be free for other use.

Note: MPLAB ICD 2 may be selected as either a debug tool or a programmer. Do not select both.

To change MPLAB ICD 2 mode from debug to program:

  1. Set the Debugger to “None” from the Debugger>Select Tool menu.
  2. Select Programmer>Select Programmer>MPLAB ICD 2 to choose MPLAB ICD 2 as a programmer. The Programmer menu and MPLAB IDE toolbar will change to display programmer options once the tool is selected. Also, the Output window will open and messages concerning ICD status and communications will be displayed on the MPLAB ICD 2 tab.

The project should rebuild now so that all debugging modes will be disabled and the Configuration bits as defined in the source code will be programmed into the target.

To program the application project’s code into the device, follow these steps:

Note: If you are using the Universal Programming Module (UPM), MPLAB ICD 2 must be powered with a power supply to be used as a programmer. Also, the option “Power target circuit from MPLAB ICD 2” on the Power tab of Programmer>Settings must be checked.

  1. Select Programmer>Settings and then click the Program tab to set the programming options for your application.
  2. Configuration bits will be set as defined in the source files. To set manually, select Configure>Configuration Bits and

set the oscillator and other Configuration bit settings appropriate to the target.

  1. If desired, set the ID bits by selecting Configure>ID Memory.
  2. Select Programmer>Blank Check to check that the device is blank/has been erased and is ready to program.
  3. Select Programmer>Program to download your code to the device in the application or demo board that is connected to the MPLAB ICD 2. Download time will depend on the memory used (i.e., program memory, EEPROM), size of program and voltage.

2.7.5 Additional Programming Options

As a programmer, MPLAB ICD 2 has several other programmer functions besides simply programming the target device.

2.7.5.1 VERIFYING THE PROGRAMMING

Select Verify from the Programmer menu or toolbar to verify that the device was programmed correctly based on the hex code in MPLAB IDE memory and the settings on the Program tab of the Settings dialog.

2.7.5.2 READING A DEVICE

Select Read from the Programmer menu or toolbar to read the device memory, based on the settings on the Program tab of the Settings dialog, into MPLAB IDE memory.

Memory read from a device into MPLAB IDE memory may then be saved to a file (File>Export). The type of file saved will depend on the type of memory read.

If you attempt to read a code-protected device, you will get a warning indicating that the device is code-protected and that the program memory may be invalid. If this happens, obtain the original hex code from a file or a non-protected device.

Getting Started

2.7.5.3 ERASE/BLANK CHECK A DEVICE

From the Programmer menu or toolbar, select the following items to erase and then blank check a device:

• Erase Device – Select Erase to erase the device memory.

Note: Internal oscillator and bandgap calibration bits are always preserved by MPLAB ICD 2 for the erase cycle. Only during programming may their values be changed.

• Blank Check – Select Blank Check to verify that the device is erased/blank.

ICD2PDF.book Page 40 Friday, November 9, 2007 3:21 PM

NOTES:

ICD2PDF.book Page 41 Friday, November 9, 2007 3:21 PM

MPLAB® ICD 2

USER’S GUIDE

Chapter 3. MPLAB ICD 2 Tutorial

3.1 INTRODUCTION

This tutorial walks you through the process of developing a simple project using the sample program, TUT452.asm, found in the directory C:\Program Files\Microchip\MPASM Suite\Example. This program is an implementation of the PIC18F452 analog-to-digital (A/D) converter using the PICDEM™ 2 Plus Demo Board (DM163022). The program configures the A/D module to convert input from A/D channel 0 (connected to the potentiometer on the demo board) and display the results on the four PORTB LEDs (RB3:RB0).

Topics covered in this chapter:

  • Setting Up The Environment
  • Running the Project Wizard
  • Viewing the Project
  • Creating a Hex File
  • Setting Debug Options
  • Setting Up the Demo Board
  • Loading Program Code For Debugging
  • Running TUT452
  • Debugging TUT452
  • Programming the Application
  • TUT452 Main Routine and Source Code

3.2 SETTING UP THE ENVIRONMENT

Before beginning this tutorial, follow the steps in Chapter 2. “Getting Started” to set up the hardware and MPLAB IDE software. Some of the initial settings covered in this tutorial may already be in place as a result of the previous set up.

Once launched, the MPLAB IDE desktop should appear.

FIGURE 3-1: MPLAB® IDE

Figure from the manual

3.2.1 Selecting the Device and Development Mode

To select the device for this tutorial:

  1. Select Configure>Select Device.
  2. In the Device Selection dialog, choose PIC18F452 from the Device list box. The “light” icon next to MPLAB ICD 2 in the Microchip Tool Support section should be green.
  3. Click OK.

Text converted from the manufacturer's document. A □ marks a character that could not be read in the original. Back to the Microchip ICD2 discussions