Microchip Technology MPLAB® Starter Kit for PIC24H Microcontrollers User’s Guide

MPLAB® Starter Kit for
PIC24H Microcontrollers
User’s Guide
© 2008 Microchip Technology Inc. DS51780A
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 t he lik e is provided only for your convenience and may be su perseded by upda t es . It is y our 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 supp ort and/or safety ap plications is entir ely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless M icrochip from any and all dama ges, claims, suits, or expenses re sulting from such use. No licens es 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, rfPIC, SmartShunt and UNI/O 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.
Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, In-Circuit Serial Programmin g , IC SP, ICEPIC, Mindi, MiW i , MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, PICkit, PICDEM, PICDEM.net, PICtail, PIC
32
logo, PowerCal, PowerInfo, PowerMate, PowerT ool, REAL ICE, rfLAB, Select Mode, Total Endurance, WiperLock and ZENA are trademarks of Microchip Technology I ncorporat ed 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.
© 2008, Microchip Technology Incorporat ed, Printed in the U.S.A., All Rights Reserved.
Printed on recycled paper.
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.
®
MCUs and dsPIC® DSCs, KEELOQ
®
code hopping
DS51780A-page ii © 2008 Microchip Technology Inc.
MPLAB® STARTER KIT FOR PIC24H
MICROCONTROLLERS USER’S GUIDE
Table of Contents
Preface ...........................................................................................................................1
Chapter 1. Introduction
1.1 Overview ............. ........................................................................................... 7
1.2 Operational Requirements .............................................................................8
1.3 Board Setu p ............. .......................... .. .. ..................................................... ... 8
Chapter 2. Starter Kit Demo
2.1 Running th e D e mo ...................................... .. .. ........................... .. .. ............. ... 9
2.2 Understanding the Demo ................................................. .......................... ..14
2.3 Other Demo Co d e E x a mp le s ..................................................... .................. 15
Chapter 3. Develop an Application
3.1 Installing the Hardware and Software .............. .. ..........................................17
3.2 Setting Up an Example Application for Debug .............................................18
3.3 Running th e E xa mple Applicat io n ............. ............. .. .. .............. .. .. ............. .. . 19
3.4 Debugging the Example Application ............................................................19
3.5 Programming the Debugged Application ........................ .. ............................22
3.6 Creating Other PIC24H MCU Applications ................................................... 22
3.7 Determining Device Support and Reserved Resources ...............................22
3.8 Troubleshooting ............................................................................................23
3.9 Settings Dia lo g , Info Tab .............................................................................. 23
Chapter 4. Hardware
4.1 Application Functional Overview ..................................................................25
4.2 Debug Functional Overview .........................................................................28
4.3 Board Components ......................................................................................29
Appendix A. Schematics
A.1 Applicati o n S c h e ma tics ....... ......................................................................... 34
A.2 Debug Schematics .......................................................................................37
Index .............................................................................................................................39
Worldwide Sales and Service ....................................................................................40
© 2008 Microchip Technology Inc. DS51780A-page iii
MPLAB® Starter Kit for PIC24H Microcontrollers User’s Guide
NOTES:
DS51780A-page iv © 2008 Microchip Technology Inc.
MPLAB® STARTER KIT FOR PIC24H
MICROCONTROLLERS 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 p age 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
®
IDE online help.
This chapter contains general information that will be useful to know before you use the MPLAB chapter include:
• Document Layout
• Conventions Used in this Guide
• Warranty Registration
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
• Customer Support
• Document Revision History
DOCUMENT LAYOUT
This document describes how to use the starter kit as a development and demonstra­tive tool for PIC24H MCU device’s processing capabilities. The manual layout is as follows:
• Chapter 1. Introduction – This chapter introduces the starter kit and provides an overview of its features.
Chapter 2. Starter Kit Demo – This chapter describes how to use the starter kit demo software.
Chapter 3. Develop an Application – This chapter describes how to debug application software on the starter kit using MPLAB
Chapter 4. Hardware – This chapter provides a functional overview of the starter kit and identifies the major hardware components.
Appendix A. Schematics – This appendix provides detailed schematic diagrams of the starter kit.
®
Starter Kit for PIC24H Microcontrollers (MCUs). Items discussed in this
®
IDE.
© 2008 Microchip Technology Inc. DS51780A-page 1
MPLAB® Starter Kit for PIC24H Microcontrollers User’s Guide
CONVENTIONS USED IN THIS GUIDE
This manual uses the following docum entat io n conven tion s:
DOCUMENTATION CONVENTIONS
Description Represents Examples
Arial font:
Italic chara c ters Referenced books MPLAB
Emphasized text ...is the only compiler...
Initial caps A window the Output window
A dialog the Settings dialog A menu selection select Enable Programmer
Quotes A field name in a window or
dialog
Underlined, italic text with right angle bracket
Bold characters A dialog button Click OK
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 r epeated text var_name [, var_name...]
A menu path File>Save
A tab Click the Power tab
where N is the tota l number of digits, R is th e radi x 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’
Choice of mut ually exclus ive arguments; an OR selection
Represents code supplied by user
“Save project before build”
4‘b0010, 2‘hF1
any valid filename
[options] errorlevel {0|1}
void main (void) { ... }
®
IDE User’s Guide
DS51780A-page 2 © 2008 Microchip Technology Inc.
WARRANTY REGISTRATION
Please complete the enclosed Warranty Registration Card and mail it promptly. Sending in the Warranty Registration Card entitles you 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 Starter Kit for PIC24H MCUs. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources.
Readme Files
For the latest information on Microchip tools, read the associated Readme files (HTML files) included with the software.
PIC24H MCU Documentation
For the most up-to-date information on PIC24H MCU devices (data sheets, errata, family reference manual, etc.), please see the Microchip web site at: http\\www.microchip.com.
MPLAB
This document helps you use Microchip’s 16-bit C compilers to develop your applica­tion. The compilers are the MPLAB C Compiler for dsPIC DSCs and PIC24 MCUs, the MPLAB C Compiler for dsPIC DSCs (subset of the first), and the MPLAB C Compiler for PIC24 MCUs (subset of the first). These compilers are GNU-based language tools, based on source code from the Free Software Foundation (FSF). For more information about FSF, see www.fsf.org.
MPLAB User’s Guide (DS51317)
This document helps you use Microchip Technology’s 16-bit language tools based on GNU technology. The language tools discussed are the MPLAB Assembler for dsPIC DSCs and PIC24 MCUs, MPLAB Object Linker for dsPIC DSCs and PIC24 MCUs, MPLAB Archiver/Librarian for dsPIC DSCs and PIC24 MCUs and other 16-bit device utilities.
MPLAB
This document describes how to use the MPLAB IDE integrated development environ­ment, as well as the MPLAB Project manager, MPLAB Editor and MPLAB SIM simulator. Use these development tools to help you develop and debug application code.
®
C Compiler for PIC24 MCUs and dsPIC® DSCs User’s Guide (DS51284)
®
Assembler, Linker and Utilities for PIC24 MCUs and dsPIC® DSCs
®
IDE User’s Guide (DS51519)
Preface
© 2008 Microchip Technology Inc. DS51780A-page 3
MPLAB® Starter Kit for PIC24H Microcontrollers User’s Guide
THE MICROCHI P 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 listin g
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 16-bit language tools:
- MPLAB C Compiler for dsPIC DSCs and PIC24 MCUs (and subsets)
- MPLAB Assembler for dsPIC DSCs and PIC24 MCUs
- MPLAB Object Linker for dsPIC DSCs and PIC24 MCUs
- MPLAB Archiver/Librarian for dsPIC DSCs and PIC24 MCUs and 8-bit language tools:
- MPLAB C Compiler for PIC18 MCUs
-MPASM™ Assembler
- MPLINK™ Object Linker
- MPLIB™ Object Librarian
In-Circuit Emulators – The latest information on Microchip in-circuit emulators. These include the MPLAB REAL ICE and MPLAB ICE 2000 in-circuit emulators.
In-Circuit Debuggers – The latest information on Microchip in-circuit debuggers. These include MPLAB ICD 2, MPLAB ICD 3, and PICkit™ 2.
MPLAB IDE – The latest information on Microchip MPLAB IDE, the Windows Integrated Development Environment for development systems tools. This list is focused on the MPLAB IDE, MPLAB IDE Project Manager, MPLAB Editor and MPLAB SIM simulator, as well as general editing and debugging features.
Programmers – The latest information on Microchip programmers. These include the MPLAB PM3 device programmer and the PICSTART development programmers.
®
Plus and PICkit 1 and 2
®
DS51780A-page 4 © 2008 Microchip Technology Inc.
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
DOCUMENT REVISION HISTORY
Revision A (November 2008)
This is the initial release of this document.
Preface
© 2008 Microchip Technology Inc. DS51780A-page 5
MPLAB® Starter Kit for PIC24H Microcontrollers User’s Guide
NOTES:
DS51780A-page 6 © 2008 Microchip Technology Inc.
MPLAB® STARTER KIT FOR PIC24H
MICROCONTROLLERS USER’S GUIDE

Chapter 1. Introduction

Thank you for purchasing Microchip Technology’s MPLAB® Starter Kit for PIC24H Microcontrollers (MCUs). This kit is intended to introduce and demonstrate the features of the starter kit and the strong processing capabilities of PIC24H MCU devices.
The starter kit demonstrates a low-cost hardware and software solution for processing sensor signals and interfacing audio and visual displays. The board also includes signal conditioning circuitry, which helps users to perform a quick evaluation of the power of PIC24H MCUs by processing signals coming from an external sensor. In addition, the starter kit has on-board debug circuitry you can use to develop and debug your own applications without using other debug tools (i.e., in-circuit emulator or debugger).
This chapter introduces the starter kit and provides an overview of its features. Topics covered include:
•Overview
• Operational Requirements
• Board Setup

1.1 OVERVIEW

The MPLAB Starter Kit for PIC24H MCUs connects directly to the USB port on a personal computer (PC). The PC USB connection supplies communications and power to the board.
The starter kit includes debug and programmer circuitry that allows applications to be programmed onto the board’s PIC24H MCU device and then debugged, all using MPLAB IDE.
The sensor signals from an on-board triaxial analog accelerometer are routed to the fast on-chip ADC module in the PIC24H MCU for software processing. This feature allows the Starter Kit to be maneuvered by tilting. Based on the sensed acceleration due to the tilting of the board, a visual output is generated on the on-board OLED display controlled by the Parallel Master Port (PMP) module. Additionally, the speech segments are audibly produced through the on-board speaker via the output compare module as a Pulse-Width Modulated (PWM) digital waveform. This output is converted to an analog speech signal by a low-pass filter on the starter kit board. Alternatively, applications can use the conditioning circuitry to plug-in a wide range of analog sensors, grab the sensor signals through the ADC and process them.
In addition to the Recommended Reading listed in the Preface, the following manufacturers’ data sheets are also recommended as reference sources:
• Bosch Sensortec Data Sheet, BMA140 Triaxial Analog Acceleration Sensor
• National Semiconductor Corporation Data Sheet, LM4853 Boomer
®
Audio Power
Amplifier Series Mono 1.5W/ Stereo 300mW Power Amplifier (DS200334)
© 2008 Microchip Technology Inc. DS51780A-page 7
MPLAB® Starter Kit for PIC24H Microcontrollers User’s Guide
MPLAB® IDE
Starter Kit
USB
PIC24H
MCU
Speaker
OLED
Display
Accelerometer

1.2 OPERATIONAL REQUIREMENTS

To communicate with and program the MPLAB Starter Kit for PIC24H MCUs, the following hardware and software requirements must be met:
• PC-compatible system
• An available USB port on the PC or a powered USB hub
• CD-ROM drive
•Windows Systems.
Note 1: Only initial testing has been performed on the 32-bit Windows Vista

1.3 BOARD SETUP

Figure 1-1 shows the setup for the MPLAB Starter Kit for PIC24H MCUs. The USB connection provides communication and power to the board. As soon as the starter kit is powered through the USB cable, the preloaded demonstration starts.

FIGURE 1-1: MPLAB STARTER KIT FOR PIC24H MCUs SETUP

®
2000 SP4, Windows XP SP2, or Windows Vista (32-bit)
Operating System for this release. The 64-bit Windows Vista Operating System is not supported at this time.
(1)
Operating
DS51780A-page 8 © 2008 Microchip Technology Inc.

Chapter 2. Starter Kit Demo

S2S1
X
Y
Z
b
MPLAB® STARTER KIT
FOR PIC24H MCU
h
Welcome
This chapter describes the MPLAB® Starter Kit for PIC24H Microcontrollers demonstration that is preloaded on the PIC24H MCU device, which showcases the multitasking of accelerometer sensing, the OLED display, speech playback, and the switch press monitor. This software application demonstrates how to use the MPLAB Starter Kit for PIC24H MCUs for signal capture and processing of the sensor signal, speech decoding and playback, and controlling the OLED display.
A detailed explanation of the starter kit hardware is provided in Chapter
4. “Hardware”. Topics covered include:
• Running the Demo
• Understanding the Demo
• Other Demo Code Examples

2.1 RUNNING THE DEMO

T o run the demo, follow these steps:
1. Power-up the starter kit by connecting the board to the USB port of a computer. You should briefly see a pop-up message in the system tray that states (1) new hardware has been found, (2) drivers are being installed, and (3) new hardware is ready for use. If you do not see these messages and the starter kit does not work, try reconnecting the USB cable. If reconnecting the USB cable does not work, refer to Section 3.8 “Troubleshooting”.
When powered up, an audible welcome message is played while simultaneously displaying the Start-up screen on the OLED display (see Figure 2-1).
MPLAB® STARTER KIT FOR PIC24H
MICROCONTROLLERS USER’S GUIDE

FIGURE 2-1: START-UP SCREEN

© 2008 Microchip Technology Inc. DS51780A- page 9
MPLAB® Starter Kit for PIC24H Microcontrollers User’s Guide
Acc. Graph
Ext. Sensor
Orientation
Games
S2S1
X
Y
Z
PIC24H Starter Kit
b
S1
S2
X
Y
Z
X
Y
Z
Acc. Graph
Ext. Sensor
Orientation
Games
S2S1
X
Y
Z
PIC24H Starter Kit
b
After the start-up exercise, the Home screen appears on the OLED display, as shown in Figure 2-2.
The Home screen has four cells from which to choose: Accelerometer (Acc.) Graph, External (Ext.) Sensor, Orientation and Games. The starter kit can be maneuvered by tilting it about the X and Y axes. Based on the direction of tilt, one of the four cells is highlighted for selection. Switch S1 or S2 can be pressed to select the highlighted cell.

FIGURE 2-2: STARTER KIT HOME SCREEN

2. Selecting the Acc. Graph cell starts the application, which captures the triaxial outputs of the accelerometer and displays them on the OLED display as a graph, as shown in Figure 2-3. Switch S1 or S2 can be pressed at any time to return to the Home screen.

FIGURE 2-3: ACCELEROMETER GRAPH

3. Selecting the Ext. Sensor cell (see Figure 2-4) starts the application, which captures the output of the external sensor that can be plugged-in at points TP12 and TP11.

FIGURE 2-4: SELECTING THE EXTERNAL SENSOR OPTION

DS51780A-page 10 © 2008 Microchip Technology Inc.
Loading...
+ 30 hidden pages