Microchip Technology dsPICDEM™ 2 Development Board User’s Guide

dsPICDEM™ 2
Development Board
User’s Guide
© 2005 Microchip Technology Inc. DS51558A
Note the following details of the code protection feature on Microchip devices:
Microchip products meet the specification contained in their particular Microchip Data Sheet.
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WAR­RANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip’s products as critical components in life support systems is not authorized except with express written approval by Microchip. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron, dsPIC, K
EELOQ, microID, MPLAB, PIC, PICmicro, PICSTART,
PRO MATE, PowerSmart, rfPIC, and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB, PICMASTER, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, dsPICDEM, dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, Linear Active Thermistor, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo, PowerMate, PowerTool, rfLAB, rfPICDEM, Select Mode, Smart Serial, SmartTel, Total Endurance and WiperLock 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.
© 2005, 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, KEEL
®
OQ
code hopping
DS51558A-page ii © 2005 Microchip Technology Inc.
dsPICDEM™ 2
DEVELOPMENT BOARD
USER’S GUIDE
Tabl e of Conten ts
Preface ........................................................................................................................... 1
Chapter 1. Introduction
1.1 Introduction ..................................................................................................... 7
1.2 Highlights ........................................................................................................ 7
1.3 dsPICDEM™ 2 Development Board .............................................................. 7
1.4 dsPICDEM™ 2 Development Board Resources ............................................ 8
1.5 Sample Application Projects ......................................................................... 12
1.6 Host System Environment ............................................................................ 12
Chapter 2. Getting Started
2.1 Introduction ................................................................................................... 13
2.2 Highlights ...................................................................................................... 13
2.3 Getting Started ............................................................................................. 13
2.4 Out-of-the-Box Demo ................................................................................... 14
2.5 Device Programming Process ...................................................................... 17
2.6 In-Circuit Debugging Process ....................................................................... 19
2.7 Summary ...................................................................................................... 20
Chapter 3. Using the dsPIC30F2010
3.1 Introduction ................................................................................................... 21
3.2 Highlights ...................................................................................................... 21
3.3 Board Setup for the dsPIC30F2010 Sample Application ............................. 21
3.4 Device Programming .................................................................................... 23
3.5 Observing the Sample Application ............................................................... 24
3.6 In-Circuit Debugging ..................................................................................... 25
3.7 Summary ...................................................................................................... 26
Chapter 4. Using the dsPIC30F2011
4.1 Introduction ................................................................................................... 27
4.2 Highlights ...................................................................................................... 27
4.3 Board Setup for the dsPIC30F2011 Sample Application ............................. 27
4.4 Device Programming .................................................................................... 29
4.5 Observing the Sample Application ............................................................... 30
4.6 In-Circuit debugging ..................................................................................... 31
4.7 Summary ...................................................................................................... 32
Chapter 5. Using the dsPIC30F2012
5.1 Introduction ................................................................................................... 33
5.2 Highlights ...................................................................................................... 33
5.3 Board Setup for the dsPIC30F2012 Sample Application ............................. 33
5.4 Device Programming .................................................................................... 35
© 2005 Microchip Technology Inc. DS51558A-page i
dsPICDEM 2 Development Board User’s Guide
5.5 Observing the Sample Application ............................................................... 36
5.6 In-Circuit Debugging ..................................................................................... 37
5.7 Summary ...................................................................................................... 38
Chapter 6. Using the dsPIC30F3010
6.1 Introduction ................................................................................................... 39
6.2 Highlights ...................................................................................................... 39
6.3 Board Setup for the dsPIC30F3010 Sample Application ............................. 39
6.4 Device Programming .................................................................................... 41
6.5 Observing the Sample Application ............................................................... 42
6.6 In-Circuit Debugging ..................................................................................... 43
6.7 Summary ...................................................................................................... 44
Chapter 7. Using the dsPIC30F3011
7.1 Introduction ................................................................................................... 45
7.2 Highlights ...................................................................................................... 45
7.3 Board Setup for the dsPIC30F3011 Sample Application ............................. 45
7.4 Device Programming .................................................................................... 47
7.5 Observing the Sample Application ............................................................... 48
7.6 In-Circuit Debugging ..................................................................................... 49
7.7 Summary ...................................................................................................... 50
Chapter 8. Using the dsPIC30F3012
8.1 Introduction ................................................................................................... 51
8.2 Highlights ...................................................................................................... 51
8.3 Board Setup for the dsPIC30F3012 Sample Application ............................. 51
8.4 Device Programming .................................................................................... 53
8.5 Observing the Sample Application ............................................................... 54
8.6 In-Circuit Debugging ..................................................................................... 55
8.7 Summary ...................................................................................................... 56
Chapter 9. Using the dsPIC30F3013
9.1 Introduction ................................................................................................... 57
9.2 Highlights ...................................................................................................... 57
9.3 Board Setup for the dsPIC30F3013 Sample Application ............................. 57
9.4 Device Programming .................................................................................... 59
9.5 Observing the Sample Application ............................................................... 60
9.6 In-Circuit Debugging ..................................................................................... 61
9.7 Summary ...................................................................................................... 62
Chapter 10. Using the dsPIC30F3014
10.1 Introduction ................................................................................................. 63
10.2 Highlights .................................................................................................... 63
10.3 Board Setup for the dsPIC30F3014 Sample Application ........................... 63
10.4 Device Programming .................................................................................. 65
10.5 Observing the Sample Application ............................................................. 66
10.6 In-Circuit Debugging ................................................................................... 67
10.7 Summary .................................................................................................... 68
DS51558A-page ii © 2005 Microchip Technology Inc.
Chapter 11. Using the dsPIC30F4011
11.1 Introduction ................................................................................................. 69
11.2 Highlights .................................................................................................... 69
11.3 Board Setup for the dsPIC30F4011 Sample Application ........................... 69
11.4 Device Programming .................................................................................. 71
11.5 Observing the Sample Application ............................................................. 72
11.6 In-Circuit Debugging ................................................................................... 73
11.7 Summary .................................................................................................... 74
Chapter 12. Using the dsPIC30F4012
12.1 Introduction ................................................................................................. 75
12.2 Highlights .................................................................................................... 75
12.3 Board Setup for the dsPIC30F4012 Sample Application ........................... 75
12.4 Device Programming .................................................................................. 77
12.5 Observing the Sample Application ............................................................. 78
12.6 In-Circuit Debugging ................................................................................... 79
12.7 Summary .................................................................................................... 80
Chapter 13. Using the dsPIC30F4013
13.1 Introduction ................................................................................................. 81
13.2 Highlights .................................................................................................... 81
13.3 Board Setup for the dsPIC30F4013 Sample Application ........................... 81
13.4 Device Programming .................................................................................. 83
13.5 Observing the Sample Application ............................................................. 84
13.6 In-Circuit Debugging ................................................................................... 85
13.7 Summary .................................................................................................... 86
Chapter 14. Hardware
14.1 Hardware Overview .................................................................................... 87
Appendix A. Hardware Drawings and Schematics
A.1 Introduction .................................................................................................. 95
Appendix B. Writing to LCD
B.1 Overview .................................................................................................... 103
B.2 LCD Hardware Setup ................................................................................. 103
B.3 LCD Software Specification ....................................................................... 103
B.4 LCD Firmware Programming: .................................................................... 104
Appendix C. Board Errata
C.1 H7 and H6 Labelling Error ......................................................................... 105
Index ........................................................................................................................... 107
Worldwide Sales and Service .................................................................................. 114
© 2005 Microchip Technology Inc. DS51558A-page iii
dsPICDEM 2 Development Board User’s Guide
DS51558A-page iv © 2005 Microchip Technology Inc.
dsPICDEM™ 2
DEVELOPMENT BOARD
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, including errata documents applicable to this product. Also, refer to the errata information in Appendix C.
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.
®
IDE on-line help.

INTRODUCTION

This chapter contains general information that will be useful to know before using the dsPICDEM 2 Development Board. Items discussed in this 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 dsPICDEM 2 Development Board as a develop­ment tool to emulate and debug firmware on a target board. The manual layout is as follows:
Chapter 1. Introduction – This chapter introduces the dsPICDEM 2
Development Board, provides a brief description of the hardware components on the board and introduces the demonstration software provided with each of the supported dsPIC30F devices.
Chapter 2. Getting Started – This chapter describes the out-of-the-box operation
of the dsPICDEM 2 Development Board. It also provides a detailed descripton of how to perform programming and in-circuit debugging operations.
Chapter 3. Using the dsPIC30F2010 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F2010 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F2010 using the sample application.
© 2005 Microchip Technology Inc. DS51558A-page 1
dsPICDEM 2 Development Board User’s Guide
Chapter 4. Using the dsPIC30F2011 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F2011 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F2011using the sample application.
Chapter 5. Using the dsPIC30F2012 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F2012 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F2012 using the sample application.
Chapter 6. Using the dsPIC30F3010 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F3010 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F3010 using the sample application.
Chapter 7. Using the dsPIC30F3011 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F3011 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F3011 using the sample application.
Chapter 8. Using the dsPIC30F3012 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F3012 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F3012 using the sample application.
Chapter 9. Using the dsPIC30F3013 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F3013 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F3013 using the sample application.
Chapter 10. Using the dsPIC30F3014 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F3014 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F3014 using the sample application.
Chapter 11. Using the dsPIC30F4011 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F4011 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F4011 using the sample application.
Chapter 12. Using the dsPIC30F4012 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F4012 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F4012 using the sample application.
Chapter 13. Using the dsPIC30F4013 – This chapter describes how to configure
the dsPICDEM 2 Development Board for use with the dsPIC30F4013 Digital Signal Controller. It provides suggested procedures for device programming and in-circuit debugging of the dsPIC30F4013 using the sample application.
Chapter 14. Hardware – This chapter provides detailed information related to the
hardware components used on the dsPICDEM 2 Development Board.
Appendix A. Hardware Drawings and Schematics – This appendix illustrates
the dsPICDEM 2 Development Board layout and includes complete schematic diagrams.
Appendix B. Writing to LCD – This appendix provides detailed instructions for
writing to the 2 x 16 character LCD.
Appendix C. Board Errata – This appendix describes errata associated with
certain revisions of the dsPICDEM 2 Development Board.
Index – This section provides cross-reference listing of terms, features and
sections of this document.
Worldwide Sales and Service – A listing of Microchip sales and service locations
and telephone numbers worldwide.
DS51558A-page 2 © 2005 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
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
‘b
nnnn
Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>
Courier font:
Plain Courier Sample source code #define START
Italic Courier A variable argument file.o, where file can be
0xnnnn A hexadecimal number where
Square brackets [ ] Optional arguments mcc18 [options] file
Curly brackets and pipe character: { | }
Ellipses... Replaces repeated text var_name [,
Preface
MPLAB® IDE User’s Guide
Emphasized text ...is the
A dialog the Settings dialog A menu selection select Enable Programmer
“Save project before build”
dialog A menu path
A tab Click the Power tab A binary number where 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
n is a hexadecimal digit
Choice of mutually exclusive arguments; an OR selection
Represents code supplied by user
File>Save
‘b00100, ‘b10
any valid filename
0xFFFF, 0x007A
[options] errorlevel {0|1}
var_name...] void main (void)
{ ... }
only
compiler...
© 2005 Microchip Technology Inc. DS51558A-page 3
dsPICDEM 2 Development Board 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 dsPICDEM 2 Development Board. Other useful documents are listed below. The following Microchip documents are available and rec­ommended as supplemental reference resources.
dsPIC30F Family Reference Manual (DS70046)
Consult this document for detailed information on the dsPIC30F device operation. The manual explains the operation of the dsPIC30F MCU family architecture and peripheral modules but does not cover the specifics of each device. Refer to the appropriate device data sheet, mentioned below, for device-specific information.
dsPIC30F Data Sheet, Motor Control and Power Conversion Family (DS70082)
Consult this document for information regarding the dsPIC30F Motor Control and Power Conversion devices. Reference information found in this data sheet includes:
• Device memory map
• Device pinout and packaging details
• Device electrical specifications
• List of peripherals included on the device
dsPIC30F Data Sheet, General Purpose and Sensor Families (DS70083)
Consult this document for information regarding the dsPIC30F General Purpose and Sensor devices. Reference information found in this data sheet includes:
• Device memory map
• Device pinout and packaging details
• Device electrical specifications
• List of peripherals included on the device
dsPIC30F Programmer’s Reference Manual (DS70030)
This manual is a software developer’s reference for the dsPIC30F 16-bit MCU family of devices. This manual describes the instruction set in detail and also provides general information to assist the user in developing software for the dsPIC30F MCU family.
dsPIC30F Family Overview, dsPIC 16-bit Digital Signal Controller (DS70043)
This document provides an overview of the features and functionality of the dsPIC DSC product family. It helps determine how the dsPIC 16-bit Digital Signal Controller Family fits a specific product application. For detailed information about any of the functionality, refer to the
MPLAB
This document details Microchip Technology’s language tools for dsPIC DSC devices based on GNU technology. The language tools discussed are:
• MPLAB ASM30 Assembler
• MPLAB LINK30 Linker
• MPLAB LIB30 Archiver/Librarian
• Other Utilities
dsPIC30F Family Reference Manual
®
ASM30, MPLAB LINK30 and Utilities User’s Guide (DS51317)
®
High Performance
(DS70046).
DS51558A-page 4 © 2005 Microchip Technology Inc.
MPLAB® C30 C Compiler User’s Guide (DS51284)
The purpose of this document is to help you use Microchip’s MPLAB C30 C compiler for dsPIC DSC devices to develop your application. MPLAB C30 is a GNU-based lan­guage tool, based on source code from the Free Software Foundation (FSF). For more information about the FSF, see www.fsf.org.
Other GNU language tools available from Microchip are:
• MPLAB ASM30 Assembler
• MPLAB LINK30 Linker
• MPLAB LIB30 Librarian/Archiver
MPLAB
Consult this document for more information pertaining to the installation and features of the MPLAB Integrated Development Environment (IDE) Software.
To obtain any of these documents, contact the nearest Microchip sales location (see back page) or visit the Microchip web site at: www.microchip.com.
®
IDE Simulator, Editor User’s Guide (DS51025)

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
Preface

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.
© 2005 Microchip Technology Inc. DS51558A-page 5
dsPICDEM 2 Development Board User’s Guide
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 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

CUSTOMER SUPPORT

Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
• Development Systems Information Line Customers should contact their distributor, representative or field application engineer
(FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in the back of this document.
Technical support is available through the web site at: http://support.microchip.com In addition, there is a Development Systems Information Line which lists the latest
versions of Microchip's development systems software products. This line also provides information on how customers can receive currently available upgrade kits.
The Development Systems Information Line numbers are: 1-800-755-2345 – United States and most of Canada 1-480-792-7302 – Other International Locations Customers may also exchange ideas with each other and with Microchip personnel by
logging on to http:\\forum.microchip.com.
®
1 development programmers.
®
II device programmers and the PICSTART®

DOCUMENT REVISION HISTORY

Revision A (June 2005)
• Initial Release of this Document.
DS51558A-page 6 © 2005 Microchip Technology Inc.

1.1 INTRODUCTION

The dsPICDEM™ 2 Development Board is a development and evaluation tool that helps you create embedded applications using dsPIC30F Digital Signal Controllers (DSC) in 18-pin PDIP, 28-pin SPDIP and 40-pin PDIP packages. The dsPICDEM™ 2 Development Board provides both a hardware and software baseline capability to help jump start your application.
Sockets are provided for 28 and 40-pin devices in the dsPIC30F Motor Control family and 18, 28 and 40-pin devices in the dsPIC30F General Purpose and Sensor family. For each device supported by the board, the product CD includes a sample application program designed specifically for that device. Thus, regardless of the dsPIC30F device you choose for your application, you also have sample code appropriate to that device.

1.2 HIGHLIGHTS

This chapter discusses:
• dsPICDEM™ 2 Development Board
• dsPICDEM™ 2 Development Board Resources
• Sample Application Projects
• Host System Environment
dsPICDEM™ 2
DEVELOPMENT BOARD
USER’S GUIDE

Chapter 1. Introduction

1.3 dsPICDEM™ 2 DEVELOPMENT BOARD

The dsPICDEM™ 2 Development Board (Figure 1-1) includes a dsPIC30F4011 Digital Signal Processor in the 40-pin motor control socket, a power supply regulator, crystal oscillators for each set of sockets, an ICD header for the MPLAB ICD 2 In-Circuit Debugger and both UART and CAN ports for external communication. In addition, the board is populated with prototyping hardware, including LED indicators, push-button switches, a potentiometer, a temperature sensor and an LCD screen. All pins on all the device sockets are accessible on prototyping areas. Also included is the dsPICDEM™ 2 Development Kit CD, which contains software and this User’s Guide.
Key hardware features include:
• Multiple sockets for 18, 28 and 40-pin PDIP and SPDIP devices
• dsPIC30F4011 40-pin PDIP sample device installed on the board
• 5V regulator provides V indicates when the power is on.
• Connector for MPLAB Emulator
• RS-232 interface
• Controller Area Network (CAN) interface
• Temperature sensor and analog potentiometer to simulate A/D inputs
• Pushbutton switches and LED indicators to simulate digital input and output
• 2x16 ASCII Character LCD with SPI™ interface
• 2x20 prototyping header area for user hardware expansion (header not provided)
DD and AVDD from a 9V DC power supply. An LED
®
ICD 2 In-Circuit Debugger or MPLAB ICE 4000 In-Circuit
© 2005 Microchip Technology Inc. DS51558A-page 7
dsPICDEM 2 Development Board User’s Guide
FIGURE 1-1: dsPICDEM™ 2 DEVELOPMENT BOARD

1.4 dsPICDEM™ 2 DEVELOPMENT BOARD RESOURCES

The dsPICDEM™ 2 Development Board accommodates the devices listed in Ta bl e 1 - 1.
TABLE 1-1: DEVICES SUPPORTED BY dsPICDEM™ 2
dsPIC30F Device Pins Socket Resources
Motor Control Family
2010 28 U2B1 Six 10-bit A/D (500 ksps) channels,
UART, SPI, I2C™ and 20 I/O pins*
3010 28 U2B1 Six 10-bit A/D (500 ksps) channels,
UART, SPI, I
3011 40 U2A1 Nine 10-bit A/D (500 ksps) channels, two
UARTs, SPI, I
4011 40 U2A1 Nine 10-bit A/D (500 ksps) channels, two
UARTs, SPI, I
4012 28 U2B1 Six 10-bit A/D (500 ksps) channels,
UART, SPI, I
General Purpose and Sensor Family
2011 18 U1C1 Eight 12-bit A/D (100 ksps) channels,
UART, SPI, I
3012 18 U1C1 Eight 12-bit A/D (100 ksps) channels,
UART, SPI, I
2012 28 U1B1 Ten 12-bit A/D (100 ksps) channels,
UART, SPI, I
3013 28 U1B1 Ten 12-bit A/D (100 ksps) channels, two
UARTs, SPI, I
3014 40 U1A1 13 12-bit A/D (100 ksps) channels, two
UARTs, SPI, I
4013 40 U1A1 13 12-bit A/D (100 ksps) channels, two
UARTs, SPI, I
* Includes pins shared by the peripheral functions
2
C and 20 I/O pins*
2
C and 30 I/O pins*
2
C, CAN and 30 I/O pins*
2
C, CAN and 20 I/O pins*
2
C and 12 I/O pins*
2
C and 12 I/O pins*
2
C and 20 I/O pins*
2
C and 20 I/O pins*
2
C and 30 I/O pins*
2
C, CAN and 30 I/O pins*
DS51558A-page 8 © 2005 Microchip Technology Inc.
Introduction
The dsPICDEM™ 2 must be configured for the device you have chosen for your appli­cation. Switches and headers are provided to connect hardware components on the board with corresponding pins on the dsPIC30F device. Figure 1-2 shows the location of hardware components and configuration headers that need to be set up depending on the dsPIC30F device.
FIGURE 1-2: dsPICDEM™ 2 HARDWARE COMPONENTS
UART Connection (J2)
CAN Connection (J3)
MPLAB® Programmer /Debugger Connection (J1)
Selector S2 (for programming and debugging)
Selector S3 (for debugging motor control devices)
Oscillator for motor control device (Y2)
Concentric sockets for motor control devices (U2A1 & U2B1 under dsPIC30F4011)
External connection prototyping headers (H8 and H9)
Temperature Header (H10) Temperature Sensor (U5) LCD SPI Header (H1) LCD Controller Programming
Header (H11)
SPI™ controller for LCD
CAN Header (H2)
Power Supply
Power Supply jumpers (JP1 and JP2)
UART1 Header (H3) Selector (S4) for debugging
general purpose devices
Alternate UART1 Header (H4) Concentric sockets for
General Purpose devices (U1A1, U1B1, U1C1) Reset switch (S1)
Oscillator for General Purpose device (Y5)
UART2 Header (H5)
Output LEDs (D3 and D4) LED Header (H12) Switches (S5 and S6) Switches Header (H6 and H7) Analog Pot (R15) Pot Header (H13)
LCD (LCD1)

1.4.1 dsPIC30F Device Sockets

For convenience, the board provides separate sockets for Motor Control family devices and general purpose/sensor family devices. As shown in Figure 1-3, the left side of the board includes concentric sockets (U2B1 and U2A1) for 28 and 40-pin devices, respec­tively, in the Motor Control family. The right side includes concentric sockets (U1C1, U1B1 and U1A1) for 18, 28 and 40-pin devices, respectively, in the General Purpose and Sensor family.
© 2005 Microchip Technology Inc. DS51558A-page 9
dsPICDEM 2 Development Board User’s Guide
FIGURE 1-3: dsPICDEM™ 2 DEVELOPMENT BOARD LAYOUT
Sockets for Motor Control Family Devices:
dsPIC30F2010 dsPIC30F3010 dsPIC30F3011 dsPIC30F4011 dsPIC30F4012
U2A1
U2B1
U1A1
U1B1
U1C1
Sockets for General Purpose and Sensor Family Devices:
dsPIC30F2011 dsPIC30F3012 dsPIC30F2012 dsPIC30F3013 dsPIC30F3014 dsPIC30F4013

1.4.2 MPLAB ICD 2 Header

An RJ11 connector (J1) allows the MPLAB ICD 2 Debugger/Programmer to be used with the dsPIC30F device you have plugged into the board. Switches S2, S3 and S4 physically connect this interface to the device sockets. Switch S2 connects the MPLAB ICD 2 interface to the default programming and debugging pins on the dsPIC30F devices (PGC/EMUC and PGD/EMUD). This switch should be turned on during programming.
Switches S3 and S4 connect the MPLAB ICD 2 interface to alternative debugging pins on the dsPIC30F devices (EMUC1/EMUD1 and EMUC2/EMUD2). These switches should be turned off during device programming and turned on during debugging, if needed.

1.4.3 UART Connection

A DB9 connector (J2) facilitates external RS-232RS-232 communication. Headers H3, H4 and H5 connect this interface to the UART peripheral in the dsPIC DSC device. Header H3 selects UART1. Header H4 selects alternate pins for UART1 in all dsPIC30F devices supported by this board. Header H5 selects UART2 in dsPIC30F devices that provide two UARTs (dsPIC30F3011, 3013, 3014, 4011 and 4013).

1.4.4 CAN Connection

A second DB9 connector (J3) is used for CAN communication. Header H2 selects the dsPIC DSC device for the CAN interface. The CAN interface is supported by dsPIC30F4011, 4012 and 4013 devices.

1.4.5 Power Supply

The dsPICDEM™ 2 power supply IS powered from an AC/DC wall adapter that furnishes 9 VDC to the PWR jack (J4). The power supply is split at the regulator to provide a separate, de-coupled analog supply voltage useful in designs taking advantage of the dsPIC30F A/D converters. The power supply includes an on-board +5V regulator for supplying V Jumpers (JP1 and JP2) let you disconnect the power supply from the board if you want to supply external DC power via terminals TP1 and TP2.
DS51558A-page 10 © 2005 Microchip Technology Inc.
DD and AVDD. An LED indicates when the power is on.
Introduction

1.4.6 Reset Switch

This pushbutton switch (S1) is tied to the MCLR pin on the dsPIC30F device. It is used to reset the device regardless of the socket used.

1.4.7 Device Clocking

Device clocking can be provided by on-chip RC oscillators, on-board crystal oscillators or external sources. Crystal (Y1) provides a 7.3728 MHz oscillator for the motor control device. Crystal (Y2) provides a 7.3728 MHz oscillator for the general purpose and sensor devices.

1.4.8 Analog and Digital Inputs

The dsPICDEM™ 2 provides the following sensors that can be used to provide input signals to your application program:
• Temperature sensor (U5)
• Potentiometer (R15)
• Pushbutton switches (S5 and S6)
1.4.8.1 TEMPERATURE SENSOR
The temperature sensor is a TC1047A that provides an analog signal to analog channel AN3 in either the general purpose or motor control device via header H10.
1.4.8.2 ANALOG POTENTIOMETER
A 5-kOhm potentiometer provides an analog signal to analog channel AN2 in either the general purpose or motor control device via header H13. The voltage source to the potentiometer is provided by VR1, through a low-pass filter. VR1 is the main voltage regulator for all components on the development board.
1.4.8.3 PUSHBUTTON SWITCHES
Two pushbutton switches, S5 and S6, are connected to external interrupt pins INT0 and INT1, respectively, on the dsPIC30F device via headers H6 and H7, respectively.

1.4.9 Digital Outputs

The dsPICDEM™ 2 provides the following output devices that can be used to display output information from your application program:
• LED Indicators (D3 and D4)
• LCD Display (LCD1/LCD2)
1.4.9.1 LED INDICATORS
LEDs D3 and D4 are connected to port pins RB0 and RB1, respectively on the installed dsPIC DSC device via header H12. The LED anodes are tied to VDD through a 1.2K resistor.
1.4.9.2 LCD DISPLAY
A 2 x 16 character dot matrix LCD display is provided on the development board. The installed dsPIC30F device writes characters to the LCD via the clock (SCK1) and data (SDO1) pins on the device’s SPI1 module.

1.4.10 External Connections

Prototyping areas H8 and H9 provide external connections from the motor control and general purpose devices, respectively. These connections allow you to use hardware and test equipment not provided on the dsPICDEM™ 2 board.
© 2005 Microchip Technology Inc. DS51558A-page 11
dsPICDEM 2 Development Board User’s Guide

1.5 SAMPLE APPLICATION PROJECTS

The dsPICDEM™ 2 Development Kit CD contains sample projects for each of the dsPIC DSC devices supported by the dsPICDEM™ 2 Development Board. These sam­ple programs are intended to jump start your application development by showing you how to implement and configure dsPIC30F peripherals such as A/D converters, exter­nal interrupts, timers, SPI, and UART interfaces and I/O ports. Complete C source code is provided that shows how to how to write interrupt service routines and how to use device control register structures for configuring peripherals and I/O ports. These sam­ple C files are bundled into MPLAB IDE projects that let you begin work out of the box.
The sample application projects and source code were created with:
• MPLAB IDE v7.11
• MPLAB C30 v1.32 The sample application projects for each dsPIC30F device are located in the folder:
path/dsPICDEM 2 Development Kit/Example Software/

1.6 HOST SYSTEM ENVIRONMENT

A host system is used to support the MPLAB IDE and ICD 2 development tools (as well as HyperTerminal® communication). Minimum requirements are:
• PC-compatible system with an Intel Pentium class or higher processor, or equivalent
• A minimum of 16 MB RAM
• A minimum of 40 MB available hard drive space
• CD ROM drive
• Microsoft Windows
®
98, Windows NT®4.0, Windows 2000 or Windows XP
DS51558A-page 12 © 2005 Microchip Technology Inc.

2.1 INTRODUCTION

The dsPICDEM™ 2 Development Board provides both a hardware and software base­line capability to help jump start your application. The board is pre-configured for and populated with a dsPIC30F4011 Digital Signal Controller (DSC). The dsPIC30F4011 is preprogrammed with a sample application program ready to run out of the box.
This chapter describes how to run the application and evaluate the program to take advantage of the sample software.

2.2 HIGHLIGHTS

Items discussed in this chapter include:
• Getting Started
• Out-of-the-Box Demo
• Device Programming Process
• In-Circuit Debugging Process
• Summary
dsPICDEM™ 2
DEVELOPMENT BOARD
USER’S GUIDE

Chapter 2. Getting Started

2.3 GETTING STARTED

The dsPICDEM 2 sample application program demonstrates key functionality of the dsPIC30F devices. This sample application program processes analog data from a temperature sensor and potentiometer provided on the board. It also processes interrupts generated from pushbutton switches on the board. Based on the input data, the program creates output in the form of LED indicators, which blink in response to the pushbutton switches, and an LCD screen, which displays the temperature and potentiometer values. The program also uses the dsPIC30F’s UART module to mirror LCD information (via RS-232 connection) to a remote terminal.
The sample application is written in C language and tailored specifically for each dsPIC30F device supported by the dsPICDEM™ 2 Development Board. Figure 2-1 outlines helpful processes to get you started using the dsPICDEM 2 board.
FIGURE 2-1: GETTING STARTED PROCESSES
Out-of-the-Box Demo Device Programming In-Circuit Debugging
Connect your PC to the dsPICDEM™ 2 board (see Figure 2-2)
Launch HyperTerminal (see Connect PC and Start HyperTerminal Session)
Open the MPLAB® IDE workspace for selected dsPIC30F device (see Setting up MPLAB IDE)
®
Build project and program the dsPIC30F device (see Build the Project)
Select MPLAB ICD 2 as Debugger, build project and program device
Set breakpoint and examine application program code
Apply power to board and run application (see Observe Sample Application)
© 2005 Microchip Technology Inc. DS51558A-page 13
Release device from reset & observe application (see Run the Application)
Evaluate program for applicability to your need
dsPICDEM 2 Development Board User’s Guide
Out-of-the-box, you can power up the dsPICDEM™ 2 Development Board and run the sample application on the dsPIC30F4011 device. The objective of this process is to acquaint you with the board and demonstrate how the dsPIC30F device interacts with the hardware components used for the demo (see Section 2.4 “Out-of-the-Box Demo”).
Eventually, as you develop your own application, you will need to program and debug the dsPIC30F device. The second phase of the getting-started process is programming the device for stand-alone operation. For this process, you attach the MPLAB ICD 2 In-Circuit Debugger to the dsPICDEM 2 board, designate it as a programmer in MPLAB IDE, build your program in MPLAB IDE and then program the device with MPLAB ICD
2. The procedures for this process are outline in Section 2.5 “Device Programming
Process”, using the dsPIC30F4011 device as an example. To examine program operation on a step-by-step basis, you need to set up MPLAB ICD
2 as a debugger. For this process you attach the MPLAB ICD 2 In-Circuit Debugger to the dsPICDEM 2 board, designate it as a debugger in MPLAB IDE, build your program in MPLAB IDE and then program the device for debug mode with MPLAB ICD 2. The procedures for this process are outline in Section 2.6 “In-Circuit Debugging
Process”, using the dsPIC30F4011 device as an example.

2.4 OUT-OF-THE-BOX DEMO

As the first phase of your getting-started process, you only need to connect your PC to the dsPICDEM™ 2 Development Board, apply power to the board and observe the sample application on the board and on HyperTerminal
®
.

2.4.1 dsPICDEM 2 Configuration

Out-of-the-box, the dsPICDEM™ 2 Development Board is configured to operate with the dsPIC304011 device. When you use a different type of supported device you need to reconfigure the board for that device. In general, you follow this process to reconfig­ure the dsPICDEM™ 2 Development Board. For the out-of-the-box configuration, you simply can verify these settings:
1. Select a supported dsPIC30F device and plug it into the appropriate socket (not
necessary out of the box).
2. Note the hardware configuration for the dsPIC30F4011device:
This functionality: Is set up by this hardware component:
Program/Debug device Switch S2 switched OFF Alternate Debugging Switch S3 or S4 – all switches OFF Temperature (A/D) H10 set to M ALL Potentiometer (A/D) H13 set to M ALL CAN H2 open UART1 H3 open Alternate UART1 H4 set to M ALL UART2 H5 open LCD (SPI) H1 set to M 40 SPI™ Controller ProgrammingH11 open Switch S5 (INT0) H6 set to M ALL Switch S6 (INT1) H7 set to M ALL External connections H8 or H9 open LEDs D3 and D4 (I/O) H12 set to M Power Supply Jumpers JP1 and JP2
Note: Chapters 3-13 provide specific set-up instructions for each type of
dsPIC30F device supported by the dsPICDEM™ 2 Development Board.
DS51558A-page 14 © 2005 Microchip Technology Inc.
Getting Started

2.4.2 Connect PC and Start HyperTerminal Session

Follow the information in Figure 2-2 to set up your PC to operate with the dsPICDEM™ 2 Development Board.
1. Use an RS-232 cable to connect the serial port on your PC to the UART connec­tor (J2) on the board.
2. On your PC, start a HyperTerminal session and set it up with these port settings: 9600 baud
8 data bits No parity 1 stop bit No flow control
Note: For convenience, each of the sample program folders contains a utility that
automatically launches HyperTerminal set up to run with the demo pro­gram. Double clicking the file (Hyperterminal_RS232_dsPICDEM2.ht) starts the session.
FIGURE 2-2: SETUP DIAGRAM
PC running HyperTerminal
®
dsPICDEM™ 2 Development Board running sample application
J1 J2
UART
J2
1234
GP 40
GP 28
GP 18
M ALL
12
Motor Control
H8 H9
CAN
J3
U2A1 U1A1
U2B1
General Purpose
J4
Connect RS-232 cable to PC
1234
U1B1
U1C1
9 VDC Power Cable
115 VAC
Apply power to the board
© 2005 Microchip Technology Inc. DS51558A-page 15
dsPICDEM 2 Development Board User’s Guide

2.4.3 Observe Sample Application

To run and observe the sample application follow these steps:
1. Plug the 9 VDC cable into the DC IN connector (J4). The PWR ON indicator
should illuminate.
2. Press the RESET ALL pushbutton (S1). The LCD displays the current tempera-
ture and voltage values, which represent the A/D conversions from the tempera­ture sensor and potentiometer, respectively.
dsPICDEM 2 Board T=+18C Pot=3.42v
The LED indicators (D3 and D4) should initially be off and then start to blink.
3. Touch the temperature sensor for a moment and observe the temperature read­ing. It should increase as your finger warms the sensor.
4. Adjust the potentiometer clockwise and observe the voltage reading increase. Then readjust it counterclockwise and observe the voltage reading decrease.
5. Observe the HyperTerminal screen and note that the information is updated to match the LCD (see Figure 2-3).
FIGURE 2-3: TYPICAL HyperTerminal
6. Press pushbutton S5 (INT0) once and note that the rate at which D3 and D4 blink changes. As you press S5 again, observe that the blink rate cycles from extremely fast (both LEDs appear to be on) to fast (blinking rapidly) to moderate (blinking slowly) to slow (appear to be switching on and off).
7. Press pushbutton S6 (INT1) once and note that D3 and D4 blink alternately. As you press S6 again, note the LEDs cycle between blinking together and blinking alternately.
®
SESSION
DS51558A-page 16 © 2005 Microchip Technology Inc.

2.5 DEVICE PROGRAMMING PROCESS

The second phase of the getting-started process introduces the MPLAB Integrated Development Environment (IDE) and MPLAB ICD 2 In-Circuit Debugger. The emphasis in this phase is to program the sample application into a dsPIC30F4011 device. After observing the demonstration, this process gets you ready to examine what you observed.

2.5.1 Connect MPLAB ICD 2

Follow the information in Figure 2-2 to set up the MPLAB ICD 2 for use as a programmer.
1. With an RJ11 cable, connect the MPLAB ICD 2 to the ICD header (J1) on the
board.
2. Use a USB cable to connect the MPLAB ICD 2 to your PC.
Note: Make sure that the USB driver for the MPLAB ICD 2 has been installed on
your PC (see the regarding the installation of MPLAB ICD 2).
MPLAB® ICD 2 User’s Guide
Getting Started
, DS51331, for more details
FIGURE 2-4: MPLAB
®
ICD 2 CONNECTION DIAGRAM
PC running MPLAB
®
IDE
MPLAB ICD 2
Connect USB cable to PC
Connect RJ-11 cable to ICD
dsPICDEM™ 2 Development Board running dsPIC30F4011 sample
J1 J2
UART
J2
1234
GP 40
GP 28
GP 18
M ALL
12
Motor Control
H8 H9
U2A1 U1A1
U2B1
J4
CAN
J3
1234
U1B1
General Purpose
U1C1
Connect RS-232 cable to PC
9 VDC Power Cable
115 VAC
application
Apply power to the board

2.5.2 Setting up MPLAB IDE

The sample application program files on the dsPICDEM 2 CD contain a workspace and project information needed by MPLAB IDE, MPLAB ICD 2 and MPLAB C30.
The first step is to open the sample application project in MPLAB IDE.
Note: These instructions presume the use of MPLAB IDE version 7.11 or newer
and MPLAB C30 version 1.32 or newer.
A project contains the files needed to build an application (source code, linker script files, etc.) along with their associations to various build tools and build options. A work­space contains information on the selected device, debug tool and/or programmer, open windows and their location, and other MPLAB IDE configuration settings.
1. Start MPLAB IDE.
2. From the
where
© 2005 Microchip Technology Inc. DS51558A-page 17
File
menu select
[path]
is the location of the sample application files.
Open Workspace>[path],
as shown in Figure 2-5,
dsPICDEM 2 Development Board User’s Guide
FIGURE 2-5: OPEN WORKSPACE DIALOG
3. Select 30F4011/Demo.mcw. A project and workspace is created in MPLAB IDE. As shown in Figure 2-6, Demo.mcw is the workspace file and Demo.mcp is the project file.
FIGURE 2-6: PROJECT WORKSPACE IN MPLAB
®
IDE
DS51558A-page 18 © 2005 Microchip Technology Inc.

2.5.3 Build the Project

Getting Started
1. Select
2. Observe the progress of the build in the Output window.
3. When BUILD SUCCEEDED displays you are ready to program the device.
4. Program the dsPIC30F4011device (
Project>Build All
.

2.5.4 Run the Application

1. From the
exectution
2. On the board, turn off the M ALL switch in S2.
3. As the code begins executing, note that the operation is identical to what you
observed out-of-the-box (see Section 2.4.3 “Observe Sample Application”)
Programmer
.
menu, select

2.6 IN-CIRCUIT DEBUGGING PROCESS

MPLAB IDE lets you run, halt and step the program. It lets you set breakpoints to examine the code at specific locations or on occurrence of specific events. It also lets you examine the contents of the RAM and registers. The MPLAB ICD 2 allows you to run the application on the dsPICDEM 2 while monitoring it in MPLAB IDE on your PC.
The examination process requires that three changes be made to the sample application setup.
• The dsPIC30F4011 device must be reprogrammed to recognize the MPLAB ICD
2 as a debugger rather than as a programmer.
• MPLAB IDE must be reconfigured to specify the pins on the dsPIC30F device to
be used for debugging.
• The dsPICDEM 2 board must be physically reconfigured to ensure that it connects
the MPLAB ICD 2 debugger to the pins on the dsPIC30F device that were specified in MPLAB IDE.
Programmer>Program
Release from Reset to
)
enable code
Note: The primary programming and debugging functions (PGC/EMUC,
PGD/EMUD) on the dsPIC30F device are multiplexed with other peripheral modules on the device used by the sample application. Thus it is necessary to use an alternate pair of debugging pins (EMUC1/EMUD1, EMUC2/EMUD2 or EMUC3/EMUD3) to examine the baseline code provided in the sample application.

2.6.1 Select MPLAB ICD 2 as Debugger

To change MPLAB ICD 2 from a programmer to a debugger for a dsPIC30F4011 device:
1. From the
MPLAB ICD 2 as the debug tool in MPLAB IDE.
2. From the
window displays the current configuration settings for the device, as shown in Figure 2-7.
3. Change the “Comm Channel Select” parameter to Use EMUC2 and EMUD2.
4. On the dsPICDEM 2 board, change the setting on switch S3 to turn on EMUC2
and EMUD2.
5. Program the dsPIC30F device (
6. On the dsPICDEM 2 board, turn off M ALL on switch S2.
7. Reset the program and run it. From the
Reset
Debugger
Configure
. Then select
menu, click
menu, select
Select Tool>MPLAB ICD 2
Debugger>Program
Debugger>Run
Configuration Bits...
Debugger
.
menu, select
to designate the
The Configuration Bits
menu).
Reset>Processor
© 2005 Microchip Technology Inc. DS51558A-page 19
dsPICDEM 2 Development Board User’s Guide
FIGURE 2-7: CONFIGURATION BITS WINDOW

2.6.2 Debugging the Code

The MPLAB ICD 2 In-Circuit Debugger can be used to run, halt and step the code. A breakpoint can be set to halt the program after the code has executed the instruction at the breakpoint. The contents of the RAM and registers can be viewed whenever the processor has been halted.
The MPLAB ICD 2 In-Circuit Debugger uses the following function keys to access the main debugging functions:
<F5> Halt <F6> Reset <F7> Single Step <F9> Run
In addition, there are more functions available by right clicking on a line of source code. These functions include the ability to set simple and advanced breakpoints.

2.7 SUMMARY

This chapter has provided a suggested process for using the dsPICDEM™ 2 Development Board to jump start your own application. If you have reviewed this process, you should be able to:
• Configure the dsPICDEM™ 2 Development Board for the dsPIC30F device you
select for your application.
• Set up MPLAB IDE to use the MPLAB ICD 2 In-Circuit Debugger.
• Locate the sample application for your dsPIC30F device.
• Program the chip with the MPLAB ICD 2.
• View the code execution in program memory and source code.
• Reset, Run, Halt and Single-Step the code.
DS51558A-page 20 © 2005 Microchip Technology Inc.

Chapter 3. Using the dsPIC30F2010

3.1 INTRODUCTION

This chapter assumes you have chosen the dsPIC30F2010 for your application. The dsPICDEM 2 Development Board supports a dsPIC30F2010 device in a 28-pin SPDIP package, as shown in Figure 3-1. This device provides six 10-bit A/D (500 ksps) channels, a UART, an SPI module, an I application program provides a software baseline for building your own embedded solution.
FIGURE 3-1: 28-PIN SPDIP dsPIC30F2010
dsPICDEM™ 2
DEVELOPMENT BOARD
USER’S GUIDE
2
C™ module and 20 I/O pins. A sample
U2B1
EMUD3/AN0/VREF+/CN2/RB0
EMUC3/AN1/V
EMUD1/SOSCI/T2CK/U1ATX/CN1//RC13
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
AN2/SS1/CN4/RB2
AN3/INDX/CN5/RB3 AN4/QEA/IC7/CN6/RB4 AN5/QEB/IC8/CN7/RB5
OSC2/CLKO/RC15
EMUD2/OC2/IC2/INT2/RD1
MCLR
REF-/CN3/RB1
OSC1/CLKI V
VDD
1
28
AV
DD
2 3 4 5 6 7
SS
8 9 10 11 12 13 14
AVSS
27
PWM1L/RE0
26
PWM1H/RE1
25
PWM2L/RE2
24
PWM2H/RE3
23
PWM3L/RE4
22
PWM3H/RE5V
21
DD
20
V
SS
19
dsPIC30F2010
PGC/EMUC/U1RX/SDI1/SDA/RF2
18
PGD/EMUD/U1TX/SDO1/SCL/RF3
17
FLTA/INT0/SCK1/OCFA/RE8
16 15
EMUC2/OC1/IC1/INT1/RD0

3.2 HIGHLIGHTS

This chapter discusses:
• Board Setup for the dsPIC30F2010 Sample Application
• Device Programming
• Observing the Sample Application
• In-Circuit Debugging
• Summary

3.3 BOARD SETUP FOR THE dsPIC30F2010 SAMPLE APPLICATION

The dsPICDEM 2 Development Board supports dsPIC30F devices that have multiple peripheral devices multiplexed on some pins. Therefore, the jumper set up of various headers depends on which of the dsPIC30F peripherals are used by the application. This section demonstrates how the board is set up for the dsPIC30F2010 device to support the dsPIC30F2010 example software in the dsPICDEM 2 Development Kit CD.
Follow these steps to configure the hardware on the dsPICDEM 2 Development Board for the sample application.
1. Disconnect the power source.
2. Remove any dsPIC30Fxxxx device currently plugged into the dsPICDEM 2 Development Board.
© 2005 Microchip Technology Inc. DS51558A-page 21
dsPICDEM 2 Development Board User’s Guide
3. Plug the dsPIC30F2010 into socket U2B1.
4. Configure the hardware components as shown in Table 3-1.
TABLE 3-1: dsPIC30F2010 CONFIGURATION SETTINGS
Header Socket U2B1
Component
Jumper JP1 JP1 Jumper 5 VDC jumper installed Jumper JP2 JP2 Jumper 5 VDC jumper installed Selector Switch S2 M ALL ON 17,18 PGC and PGD Selector Switch S3 OFF Not used in this configuration Selector Switch S4 OFF Not used in this configuration PGM U3 H11 Open — CAN Tx H2 Open — CAN Rx H2 Open — UART1 Tx* H3 Open UART1 Rx* H3 Open Alternate UART1 Tx*H4 M ALL 11 EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13 Alternate UART1 Rx* UART2 Tx* H5 Open UART2 Rx* H5 Open Temperature Sensor H10 M ALL 5 AN3/INDX/CN5/RB3 Potentiometer H13 M ALL 4 AN2/SS1 Switch S5 H6 M ALL 16 FLTA/INT0/SCK1/OCFA/RE8 Switch S6 H7 M ALL 15 EMUC2/OC1/IC1/INT1/RD0 LED D3 H12 M D3 2 EMUD3/AN0/V LED D4 H12 M D4 3 EMUC3/AN1/V LCD - SPI™ Clock LCD - SPI Data
* On this device, multiplexing of various peripherals on the pins does not allow the
*
simultaneous use of: – Switch S5 and LCD – Primary UART1 pins and LCD. Since only one DB-9 connector is provided for RS-232 communication, you can select either UART1 (primary or alternate pins) or UART2, but not both.
No.
H4 M ALL 12 EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
*
H1 M28 16 FLTA/INT0/SCK1/OCFA/RE8 H1 M28 17 PGD/EMUD/U1TX/SDO1/SCL/RF3
Jumper
Setting
Pin Device Functions (see Figure 3-1)
/CN4/RB2
REF+/CN2/RB0 REF-/CN3/RB1
5. Connect the RS-232 cable from the PC to the UART connector (J2).
6. Reapply power to the DC IN connector (J4). The PWR ON LED should illuminate.
7. Load the sample application program for the dsPIC30F2010 (see
Section 3.4 “Device Programming”).
DS51558A-page 22 © 2005 Microchip Technology Inc.

3.4 DEVICE PROGRAMMING

Load the sample application program for the dsPIC30F2010 using this process:
1. Plug the RJ11cable from the MPLAB ICD 2 into the ICD header (J1). Make sure the USB cable from the MPLAB ICD 2 is connected to your PC.
2. Start MPLAB IDE.
3. Open the dsPIC30F2010 sample project (
path/dsPICDEM 2 Development Kit/Example Soft­ware/30F2010/Demo.mcw
Note: For detailed information and procedures on using the MPLAB IDE and ICD
2 refer to Chapter 2 “Getting Started”.
Using the dsPIC30F2010
File>Open Workspace)
.
from
4. Build the sample project in MPLAB IDE (
5. On the dsPICDEM™ 2 board set all positions on switches S3 and S4 to OFF. Then set switch S2 to M ALL. The MPLAB ICD 2 is now connected to the PGC and PGD pins on the dsPIC30F2010.
6. Download the sample application ( (Figure 3-2) displays the status as the download occurs and indicates when the programming has succeeded.
FIGURE 3-2: PROGRAMMING THE dsPIC30F2010 DEVICE
Project>Build All)
Programmer>Program
.
). The Output window
7. Disconnect the MPLAB ICD 2 cable from the ICD header. The program is now ready to run (see Section 3.5 “Observing the Sample Application”).
© 2005 Microchip Technology Inc. DS51558A-page 23
dsPICDEM 2 Development Board User’s Guide

3.5 OBSERVING THE SAMPLE APPLICATION

1. Press RESET ALL. The program begins to run.
2. Set up a HyperTerminal session on the PC to run with these parameters:
Port Setting Value
Bits per second 9600 Data bits 8 Parity None Stop bits 1 Flow control None
As a shortcut, you can launch the Hyperterminal_RS232_dsPICDEM2.ht file in the dsPICDEM 2 Development Kit/Example Software/30F2010 folder.
3. See information on LCD. Note that the HyperTerminal displays the same information.
4. Adjust temperature and note LCD and HyperTerminal readings.
5. Adjust potentiometer and note LCD and HyperTerminal readings.
6. Observe the rate at which LEDs D3 and D4 blink.
7. Press S6 (INT1) and note the affect on D3 and D4.
DS51558A-page 24 © 2005 Microchip Technology Inc.
Loading...
+ 85 hidden pages