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
WARRANTIES 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, KEELOQ logo, MPLAB, PIC, PICmicro,
PICSTART, PRO MATE, rfPIC and SmartShunt are registered
trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
FilterLab, Linear Active Thermistor, MXDEV, MXLAB,
SEEVAL, SmartSensor and The Embedded Control Solutions
Company are registered trademarks of Microchip Technology
Incorporated in the U.S.A.
logo, PowerCal, PowerInfo,
PowerMate, PowerTool, REAL ICE, rfLAB, Select Mode, 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.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
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.
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 online help files.
INTRODUCTION
This document is intended to enable new PIC32 users to get a basic hardware and software understanding of the PIC32 architecture and quickly get started with software
development for PIC32 products.
This document is primarily written for anyone wanting to get overview knowledge of
PIC32 microcontrollers and associated technical collateral provided by Microchip and
its third party tools partners. A basic understanding of embedded systems development
and 'C' programming knowledge is required, if you are planning to follow step-by-step
instructions provided later in this document.
This chapter contains general information that will be useful to know before using the
PIC32. Items discussed in this chapter include:
• Document Layout
• Conventions Used in this Guide
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
This document is divided into 6 sections. Sections 1 through 4 provide an overview of
PIC32 products. Section 5 provides an overview of PIC32 development tools. Section
6 describes the procedure to setup a development environment and debug a sample
application. The manual layout is as follows:
• Chapter 1. PIC32 Features
• Chapter 2. PIC32 Product Family
• Chapter 3. PIC32 Architecture
• Chapter 4. PIC32 Tools
• Chapter 5. Step-by-Step Procedures to Setup, Build, and Run a Demo Project
This user's guide describes how to use PIC32. Other useful documents are listed
below. The following Microchip documents are available and recommended as supplemental reference resources.
Readme for the PIC32MX
For the latest information on using PIC32 microcontrollers, read the file (an ASCII text
file) at the root level of the CD included in the PIC32 Starter Kit. The file generally contains the most current update information, as well as any issues that may not have been
available when this document was published.
Readme Files
For the latest information on using other tools, read the tool-specific readme files in the
Readmes subdirectory of the PIC32MX Starter Kit installation directory. The files contain update information, as well as any issues that may not have been available when
this document was published.
THE MICROCHIP WEB SITE
Microchip provides online 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, 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
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 C32 C compilers; 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 the 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, PICkit
®
IDE – The latest information on Microchip MPLAB IDE, the Windows®
®
®
1 and PICkit® 2 development programmers.
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
The PIC32 is a 32-bit family of general purpose microcontrollers from Microchip
Technology. It offers 80+ DMIPS performance with a wide variety of on-chip peripherals. It employs industry leading M4K MIPS32 core from MIPS Technologies, Inc.
All members in the PIC32 family use programming interface similar to other Microchip PIC
patible with the PIC24FJ128GA family of 16-bit microcontrollers.
1.2HIGHLIGHTS
The PIC32 family offers a number of features to enable a wide variety of applications.
The following subsections list all the key features grouped in major categories.
Performance:
• Up to 80 MHz, MIPS M4K 32-bit core with 5 stage pipeline
• High-performance hardware multiply/divide unit – 1 multiply per clock
• Programmable user and kernel memory partition for enhanced application stability
• Multiple register sets for reduced interrupt latency
The PIC32 family includes scalable devices ranging from 32KB to 512KB of Flash
memory. Also a rich set of peripherals – Five timers, 16 channels of 10-bit A/D
Converters and communication interfaces: SPI, I
Please consult the “PIC32MX Family Data Sheet” (DS61143) for a complete list of
family variants, core and peripheral characteristics.
The PIC32 family of MCUs combines the MIPS M4K core together with powerful
peripherals and embedded Flash and RAM memory to address a wide range of
applications.
FIGURE 3-1:PIC32 BLOCK DIAGRAM
PORTA
PORTB
PORTC
PORTD
PORTE
GETTING STARTED WITH PIC32
V
ENVREG
USBCLK
SYSCLK
PBCLK
DMAC
32
DDCORE/VCAP
Volt age
Regulator
Precision
Band Gap
Reference
(1)
Peripheral Bridge
ICD
Power-up
(1)
32
32
Oscillator
Start-up Timer
Power-on
Watchdog
Brown-out
Reset
32
Timer
Reset
Timer
(2)
Peripheral Bus Clocked by PBCLK
32
V
MCLR
CN1-22
PWM
OC 1,5
IC 1,5
SPI 1,2
I2C 1,2
PMP
DD
,
SS
V
(1)
(1)
(1)
OSC2/CLKO
OSC1/CLKI
(1)(4)
(1)
(1)
(1)
32
JTAG
BSCAN
EJTAGINT
MIPS M4K CPU Core
ISDS
32
Pre-Fetch
Module
OSC/SOSC
Oscilla tors
FRC/LPRC
Oscillators
PLL
DIVIDERS
PLL-USB
Timing
Generati on
Peripheral Bus Clocked by SYSCLK
Priority
Interrupt
Controlle r
32
Bus Matrix
32
(1)
Data RAM
USB
32
32
(1)
PORTF
PORTG
(1)
Time r1
128
128-bit wide
Program Flash
Peripheral Bus Clocked by PBCLK
Time r2
Time r3
Memory
UART 1,2
Flash
Controller
Time r5Time r4
RTCC
10-bit ADC
Comparators
Peripheral Bus
Note 1: Not all pins or features are implemented on all device pinout configurations.
See Table 1-4 for I/O port pin descriptions.
2: Some features are not available on certain device variants.
3: BOR functionality is provided when the on-board voltage regulator is enabled.
The PIC32 microcontrollers are supported by the MPLAB Integrated Development
Environment and its full range of hardware and software tools.
4.2HIGHLIGHTS
Items discussed in this chapter are:
• MPLAB IDE
• MPLAB C32 C Compiler
• Peripheral Libraries
• Software Solutions
• Demonstration, Development and Evaluation Boards
• Technical Documentation
4.3MPLAB IDE
The Microchip MPLAB IDE is a FREE development toolsuite for Microsoft Windows®
that contains:
• A single graphical interface to all debugging tools:
- Simulator
- Programmers
-Emulators
- In-Circuit Debuggers
• A full-featured editor with color-coded context
• A project manager
• Customizable data windows with in-place editable contents
• High-level source code debugging
• Extensive on-line help
The MPLAB IDE provides integrated debugging and programming facilities using any
of the following probes connected to the target processor/Development Board:
• MPLAB ICD 2 In-Circuit Debugger: a low-cost, run-time development tool.
• MPLAB REAL ICE In-Circuit Emulator: a high speed in-circuit emulator with
hardware and software trace capabilities.
• FS2 JTAG probe: Developed by First Silicon Solutions, this probe uses 4-wire
EJTAG interface to debug and program the PIC32 microcontrollers.
• MPLAB PM3 Device Programmer: a Microchip universal device programmer
suitable for development and manufacturing purposes.
• MPLAB SIM32 Device Simulator: Accurately simulates many PIC32 peripherals
and the CPU in selectable cycle and clock-accurate modes
PIC32 MCUs integrate a large number of on-chip high-performance peripherals.
To accelerate the usage of these peripherals, the MPLAB C32 compiler for PIC32
includes software peripheral libraries compatible with the 16-bit Microchip MCUs. The
peripheral libraries are distributed in source and object format along with a detailed API
description document. Software applications using MPLAB C32 compiler may call
peripheral library functions by simply including the appropriate header file in their
source files – the MPLAB C32 compiler has built-in knowledge of library header and
archive files.
The peripheral include files are located in C:\Program Files\Microchip\MPLAB
C32\pic32mx\include\peripheral and the full source code is located in
C:\Program Files\Microchip\MPLAB C32\pic32-libs\peripheral loca-
tion in corresponding peripheral sub-directory.
The Peripheral Library contains following include files:
At the time of writing this document, Microchip had not released any drivers. Microchip
does intend to develop drivers for key communication peripherals.
4.6.1Middleware
The following list provides the Microchip middleware components available at the time
of writing this document:
• 16-bit file system on SD Memory to support Microsoft MS-DOS file system.
• Two types of TCP/IP stack – 1) Microchip legacy TCP/IP Stack – fully compatible
with Microchip 8- and 16-bit Stack, 2) Microchip BSD TCP/IP Stack – A Berkeley
socket API stack with many advanced features.
• TCP/IP middleware:
- FTP server to allow the application running on the target PIC32 machine to be
a File Transfer Protocol server.
- SNMP Agent to monitor PIC32 products using SNMP protocol.
- Web server to accept HTTP requests from Web browsers clients.
•USB middleware:
- USB Embedded Host Stack (HID and Mass Storage)
- USB Device Stack (HID, Mass Storage and CDC class)
PIC32 Tools
4.6.23rd Party Tools
Check the PIC32 home page (www.microchip.com/PIC32) to learn about the list of
companies with support for PIC32.
4.7DEMONSTRATION, DEVELOPMENT AND EVALUATION BOARDS
A wide variety of demonstration, development and evaluation boards for PIC32 MCUs
allow quick application development on fully functional systems. Most boards include
prototyping areas for adding custom circuitry and provide application firmware and
source code for examination and modification. These boards support a variety of
features, including LEDs, switches, RS-232 interfaces, LCD displays, etc. The
demonstration and development boards can be used in teaching environments, for
prototyping custom circuits and for learning about various microcontroller applications.
Currently, the following boards are available:
1. PIC32MX Starter kit (DM320001).
2. Explorer 16 board (DM240001) with PIC32 Plug-in Modules.
4.8TECHNICAL DOCUMENTATION
The current set of documents that are available for PIC32 MCUs:
• Application Notes:
- AN833, “Microchip TCP/IP Stack” (DS00833)
- AN1107, “HTTP Server for the Microchip BSD TCP/IP Stack” (DS01107)
- AN1108, “Microchip TCP/IP Stack with BSD Socket API” (DS01108)
- AN1109, “An SNMP Agent for the Microchip TCP/IP Stack” (DS01109)
- AN 1111, “ The Microchip FTP Server Using BSD Socket API” (DS01111 )
Chapter 5. Step-by-Step Procedures to Setup, Build, and Run a Demo Project
5.1INTRODUCTION
In this step-by-step procedure, the basic concepts of the MPLAB Project Manager,
Editor and Debugger will be presented. You will create a simple project and understand
the debug capabilities of MPLAB IDE.
No previous MPLAB IDE knowledge is assumed. For complete features set and
comprehensive technical details of MPLAB IDE and its components, please visit our
web site (www.microchip.com/ide).
5.2HIGHLIGHTS
Items discussed in this chapter are:
• MPLAB IDE Setup
• Step-by-Step Guide Overview
• Selecting the Device
• Creating the Project
• Setting Up Language Tools
• Naming the Project
• Adding Files to the Project
• Attaching the Debugger
• Building the Project
• Testing the Code
5.3MPLAB IDE SETUP
5.3.1Install MPLAB IDE
To install the MPLAB on your system, you could either use the supplied installation CD
or download the latest MPLAB IDE from the Microchip web site.
- To install from a CD-ROM, just place the disk into a CD drive and follow the
on-screen prompts (you could use Windows Explorer to find and execute the
CD-ROM menu, menu.exe).
- If the MPLAB IDE was downloaded from the Microchip web site, unzip the file
and execute the resulting file to install.
Note:Administrative access will be required to install the MPLAB on a PC.
5.3.2To uninstall MPLAB IDE
-Select Start>Settings>Control Panel to open the control panel.
- Double click on Add/Remove Programs. Find MPLAB IDE and select it.
- Click Change/Remove to remove the program from your system.
Note:Administrative access might be required in order to uninstall the MPLAB.
To start MPLAB IDE, double click on the icon installed on the desktop after installation
or select Start>Programs>Microchip>MPLAB IDE vx.xx>MPLAB IDE
display the MPLAB IDE logo followed by the MPLAB IDE desktop.
FIGURE 5-1:MPLAB IDE START SCREEN
. A screen will
5.4STEP-BY-STEP GUIDE OVERVIEW
To create code that is executable by the PIC32 MCU, source files need to be part of a
project. The code can then be built into executable code using selected language tools
(assemblers, compilers, linkers, etc.). In MPLAB IDE, the project manager controls this
process and will guide us through most of these steps.
All projects will have these basic steps:
- Select Device
The capabilities of MPLAB IDE vary according to which device is selected. Device
selection should be completed before starting a project.
- Create Project
MPLAB IDE Project Wizard will be used to create a project.
- Select Language Tools
In the Project Wizard the language tools will be selected. For this tutorial, the PIC32
tools will be used. For other projects, either other Microchip or third party tools might
be selected.
- Add Files in Project
We’ll add a template file and a linker script to the project.
Step-by-Step Procedures to Setup, Build, and Run a Demo Project
Some very simple code will be added to the template file to print a “Hello World…”
string to a serial console connected to the evaluation board. We will use the UART
Peripheral Library provided by Microchip.
- Build Project
The project will be built – causing the source files to be compiled and linked into
machine code that can run on the selected PIC32 MCU.
- Test Code
Finally, the code will be tested by running it on the evaluation board.
Note:Some aspects of the user interface will change in future product releases
and the screen shots in this guide may not exactly match the appearance
of the MPLAB IDE desktop in later releases.
5.5SELECTING THE DEVICE
Choose Configure>Select Device from the top IDE menu. In the Device dialog, select
the PIC32 variant from the drop-down list.
FIGURE 5-2:MPLAB IDE SELECT DEVICE
The “lights” indicate which MPLAB IDE components support this device.
- A green light indicates full support.
- A yellow light indicates preliminary support for an upcoming part by the
particular MPLAB IDE tool component. Components with a yellow light
instead of a green light are often intended for early adopters of new parts
who need quick support and understand that some operations or functions
may not be available.
- A red light indicates no support for this device. Support may be forthcoming or
inappropriate for the tool.
The next step is to create a project using the Project Wizard. A project is the way the
files are organized to be compiled, assembled and linked. We will use a single “C” file
for this project and a linker script.
Choose Project>Project Wizard
From the Welcome dialog, click on Next> to advance.
The Step One dialog allows you to select the device, which we’ve already done. Make
sure that it displays the proper PIC32 variant. If not, select the required PIC32 variant
from the drop down menu. Click Next>.
Step-by-Step Procedures to Setup, Build, and Run a Demo Project
5.7SETTING UP LANGUAGE TOOLS
Step Two of the Project Wizard sets up the language tools that are used with this
project. Make sure the “Show all installed toolsuites” checkbox is checked. Select
Microchip PIC32 C Compiler Toolsuite in the Active Toolsuite list box.
Then “MPLAB PIC32 Assembler (PIC32-as.exe)”, “MPLAB PIC32 C Compiler
(PIC32-gcc.exe)”, “MPLAB PIC32 Object Linker (PIC32-ld.exe)”, and “MPLAB PIC32
Archiver (PIC32-ar.exe)”, should be visible in the Toolsuite Contents box. Click on each
one to see its location. If MPLAB IDE was installed into the default directory, the paths
for these files will be:
Step Three of the wizard allows you to name the project and put it into a folder. This
sample project will be called MyTestProject. Using the Browse button, place the project
in a folder named Projects32. Click Next>.
Step-by-Step Procedures to Setup, Build, and Run a Demo Project
5.9ADDING FILES TO THE PROJECT
Step Four of the Project Wizard allows file selection for the project. This is where we
can add existing files to our project. In the current example we don’t have a previously
created file but we’ll create one once we’re done with the new project setting.
Just press Next> and the following Summary Screen will show up:
Be sure to save the workspace in the Projects32 directory and name this workspace
using the same name as for the project: MyTestProject.
Click Save.
The project space is now completely created and it should look like that:
FIGURE 5-8:MPLAB IDE PROJECT SAVE
Now we’ll create our C source file. If the MPLAB IDE Editor window is not open, click
File->New
The Editor window will show up.
Let’s type in a very simple Hello World program in the Editor window and save it in
Projects32 directory as main.c. We’ll use the UART Peripheral Library provided by
Microchip:
from the top menu or the New File menu shortcut on the standard toolbar.
Step-by-Step Procedures to Setup, Build, and Run a Demo Project
FIGURE 5-9:MPLAB IDE MAIN.C FILE
To add the newly created main.c file to our project just right click on the Source Files
folder in the MPLAB IDE MyTestProject.mcp window and select Add File. Browse and
select main.c file from the Projects32 directory.
Note:If the Project window is not open, select View->Project from the top IDE
menu.
The linker script that’s needed for this project is selected automatically by the MPLAB
IDE. We don’t need to add any other file to our project.
Right click on MyTestProject.mcp window and select Save. The test project should be
saved. The MyTestProject.mcp should look like:
FIGURE 5-10:MPLAB IDE PROJECT SAVED
TIP: Files can be added and projects saved by using the right mouse button in the
project window. In case of error, files can be manually deleted by selecting them and
using the right mouse click menu.
Step-by-Step Procedures to Setup, Build, and Run a Demo Project
5.10ATTACHING THE DEBUGGER
In order to test the code using the PIC32 Starter Kit, please refer to the PIC32MX
Starter Kit User’s Guide (DS61144 ) for a sample project and a step-by-step getting
started info.
For the purpose of testing our code in this document we will use an Explorer 16
Development board (DM240001), a MPLAB REAL ICE In-Circuit Debugger
(DV244005) and a PIC32MX360F512L PIM (MA320001) together with a 9V universal
power supply, a serial cable and a USB cable for connecting the REAL ICE to the
development board.
FIGURE 5-11:EXPLORER 16, MPLAB
PIC32MX360F512L PIM
Take the following steps to ensure proper connection of the REAL ICE to the Explorer
16 development board:
1. Connect the MPLAB REAL ICE module to the PC with the USB cable.
2. Connect the MPLAB REAL ICE to the Explorer 16 Development Board with the
short RJ-11 cable.
3. Apply power to the Explorer 16 board.
4. From the Debugger menu, click Select Tool > MPLAB REAL ICE
MPLAB REAL ICE as the debug tool in MPLAB IDE.
5. From the Debugger menu, select Connect to connect the debugger to the device.
MPLAB IDE should report in the Output window that it found the
PIC32MX360F512L device.
®
REAL ICE™ AND
to set the
Note:MPLAB IDE may need to download new firmware if this is the first time the
MPLAB REAL ICE is being used with a PIC32 device. Allow it to do so.
Once you have performed these steps, go to the MPLAB IDE window and from the
Debugger->Select Tool
board (i.e., MPLAB REAL ICE should be within the available choices).
Once you have selected the tool, the “Debug Toolbar” should be present just below the
main menu bar, together with other toolbars that may be selected.
Note:Be sure to select Debug from the MPLAB IDE Build Configuration drop
menu select the debugging tool you’re using to connect to the
Getting Started with PIC32
5.11BUILDING THE PROJECT
From the Project menu, we can compile and link the current files.
To build the project, select either:
-
Project>Build All
- Right click on the project name in the project window and select Build All
- Click the Build All icon on the Project toolbar. Hover the mouse over icons to
see pop-up text of what they represent.
The Output window shows the result of the build process. There should be no errors
on any step.
FIGURE 5-12:MPLAB IDE PROJECT BUILD
5.12TESTING THE CODE
First download the hex image of the program we just built by selecting Debugger->Program from the Debugger menu or directly program from the “Debug Toolbar”. The
programming operation should occur with no errors.
In order to test our example application, we need to set-up the PC part too.
Connect a serial cable between the board RS-232 connector and one of the PC’s COM
ports and open a Hyper Terminal application on the PC (Programs->Accessories->Communications->Hyper Terminal).
Select a proper name for this connection, click OK and then, in the “Connect To” screen
select the COM port that’s connected to the development board.
Step-by-Step Procedures to Setup, Build, and Run a Demo Project
FIGURE 5-13:HYPER TERMINAL CONNECTION SCREEN
Click OK and, on the next screen, select the following communication settings:
• Bits Per Second: 57600
•Data Bits: 8
• Parity: None
• Stop Bits: 1
• Flow Control: None
Click OK and the Hyper Terminal session should be connected to the serial port on the
development board.
Now return to the MPLAB IDE and double click on the line:
return nc;
in the MPLAB IDE Editor window, the main.c program, to set a breakpoint on that line,
just after the call to strlen().
Click Debugger->Run from the main menu, or Run from the Debug toolbar. The
program should start running and it will reach the set breakpoint. The MPLAB IDE
window will look very similar to this one:
Step-by-Step Procedures to Setup, Build, and Run a Demo Project
Also, if you look at the Explorer 16 board, you should see the LED D9 lit on.
This shows that the PIC32 Explorer16 demo board and the MPLAB IDE operate
correctly.
We just made our first “Hello World” program for PIC32.
There are many other things that you can do in the MPLAB IDE to debug your program.
For example, you can notice in that by hovering the mouse over the variable “nc” we
can see its actual value (which should be the number of characters sent to the serial
port by the putsUART2() function).
Other MPLAB IDE debug features:
• Watch window: you can add variables of peripheral SFRs to the watch window
and monitor their values
• Complex Breakpoint manipulation
• All the useful debug commands: step into, step over, etc, using both the C Source
window and the disassembly listing window.
• Profile your code execution and calculate delay times between different points in
your program.
We presented here the essential steps for getting started with PIC32 using the MPLAB
IDE. You are now ready to continue exploring the capabilities of PIC32 and MPLAB
IDE. For further information about PIC32 please see the documentation list provided in
this document. For more information about the MPLAB IDE please see the “MPLAB IDE Quick Start Guide” (DS51281) available on our site at www.microchip.com
following the Design link.