SlideShare a Scribd company logo
 2011 Microchip Technology Inc. DS41584A
PICDEM™ 2 Plus
Demonstration Board
User’s Guide
DS41584A-page 2  2011 Microchip Technology Inc.
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, dsPIC,
KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART,
PIC32
logo, rfPIC and UNI/O are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL 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, chipKIT,
chipKIT logo, CodeGuard, dsPICDEM, dsPICDEM.net,
dsPICworks, dsSPEAK, ECAN, ECONOMONITOR,
FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP,
Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB,
MPLINK, mTouch, Omniscient Code Generation, PICC,
PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE,
rfLAB, Select Mode, Total Endurance, TSHARC,
UniWinDriver, 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.
© 2011, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
ISBN: 978-1-61341-248-0
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.
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® MCUs and dsPIC® DSCs, KEELOQ® code hopping
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.
PICDEM™ 2 PLUS DEMONSTRATION
BOARD USER’S GUIDE
 2011 Microchip Technology Inc. DS41584A-page 3
Table of Contents
Preface ........................................................................................................................... 5
Chapter 1. Introduction
1.1 Introduction ............................................................................................. 11
1.2 Development Kit Contents ...................................................................... 11
1.3 PICDEM™ 2 Plus Demonstration Board ................................................ 11
1.4 On-Board Jumper Configurations ........................................................... 13
1.5 Sample Devices ...................................................................................... 13
1.6 Sample Programs ................................................................................... 14
Chapter 2. Getting Started
2.1 PICDEM™ 2 Plus Demonstration Board as a Stand-Alone Board –
Preprogrammed Device .......................................................................... 15
2.2 Programming the Device ........................................................................ 16
2.3 Powering the Board ................................................................................ 20
Chapter 3. Tutorial
3.1 Tutorial Program Operation .................................................................... 23
3.2 Source Code and Application Notes ....................................................... 28
Appendix A. Hardware Detail
A.1 Processor Sockets .................................................................................. 31
A.2 Display .................................................................................................... 31
A.3 Power Supply ......................................................................................... 31
A.4 RS-232 Serial Port .................................................................................. 31
A.5 Switches ................................................................................................. 32
A.6 Oscillator Options ................................................................................... 32
A.7 Analog Input ........................................................................................... 32
A.8 ICD Connector ........................................................................................ 32
A.9 PICkit™ Connector ................................................................................. 32
A.10 Temperature Sensor ............................................................................... 32
A.11 Serial EEPROM ...................................................................................... 32
A.12 LCD ........................................................................................................ 32
A.13 Sample Devices ...................................................................................... 33
A.14 Board Layout and Schematics ................................................................ 34
Worldwide Sales and Service .................................................................................... 38
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 4  2011 Microchip Technology Inc.
NOTES:
PICDEM™ 2 PLUS DEMONSTRATION
BOARD USER’S GUIDE
 2011 Microchip Technology Inc. DS41584A-page 5
Preface
INTRODUCTION
This chapter contains general information that will be useful to know before using the
PICDEM™ 2 Plus Demonstration 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 the PICDEM™ 2 Plus Demonstration Board as a
development tool to emulate and debug firmware on a target board. The manual layout
is as follows:
• Chapter 1. “Introduction” – Introduces the PICDEM 2 Plus Demonstration
Board and provides a brief description of the hardware.
• Chapter 2. “Getting Started” – Goes through a basic step-by-step process for
getting your PICDEM 2 Plus Demonstration Board up and running as a
stand-alone board or with an ICE, ICD or PICkit™ programmer.
• Chapter 3. “Tutorial” – Provides a detailed description of the tutorial program.
• Appendix A. “Hardware Detail” – Describes in detail the hardware of the
PICDEM 2 Plus Demonstration Board.
NOTICE TO CUSTOMERS
All documentation becomes dated, and this manual is no exception. Microchip tools and
documentation are constantly evolving to meet customer needs, so some actual dialogs
and/or tool descriptions may differ from those in this document. Please refer to our web site
(www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each
page, in front of the page number. The numbering convention for the DS number is
“DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the
document.
For the most up-to-date information on development tools, see the MPLAB® IDE on-line help.
Select the Help menu, and then Topics to open a list of available online help files.
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 6  2011 Microchip Technology Inc.
CONVENTIONS USED IN THIS GUIDE
This manual uses the following documentation conventions:
DOCUMENTATION CONVENTIONS
Description Represents Examples
Arial font:
Italic characters Referenced books MPLAB®
IDE User’s Guide
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
“Save project before build”
Underlined, italic text with
right angle bracket
A menu path File>Save
Bold characters A dialog button Click OK
A tab Click the Power tab
N‘Rnnnn A number in verilog format,
where N is the total number of
digits, R is the radix and n is a
digit.
4‘b0010, 2‘hF1
Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>
Courier New font:
Plain Courier New Sample source code #define START
Filenames autoexec.bat
File paths c:mcc18h
Keywords _asm, _endasm, static
Command-line options -Opa+, -Opa-
Bit values 0, 1
Constants 0xFF, ‘A’
Italic Courier New A variable argument file.o, where file can be
any valid filename
Square brackets [ ] Optional arguments mcc18 [options] file
[options]
Curly brackets and pipe
character: { | }
Choice of mutually exclusive
arguments; an OR selection
errorlevel {0|1}
Ellipses... Replaces repeated text var_name [,
var_name...]
Represents code supplied by
user
void main (void)
{ ...
}
Preface
 2011 Microchip Technology Inc. DS41584A-page 7
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 PICDEM™ 2 Plus Demonstration Board. Other
useful documents are listed below. The following Microchip documents are available
and recommended as supplemental reference resources.
Readme for PICDEM™ 2 Plus Demonstration Board
For the latest information on using the PICDEM™ 2 Plus Demonstration Board, read
the “Readme for PICDEM™ 2 Plus Demonstration Board.txt” file (an ASCII
text file) in the Readmes subdirectory of the MPLAB IDE installation directory. The
Readme file contains update information and known issues that may not be included in
this user’s guide.
Readme Files
For the latest information on using other tools, read the tool-specific Readme files in
the Readmes subdirectory of the MPLAB IDE installation directory. The Readme files
contain update information and known issues that may not be included in this user’s
guide.
Reference Documents
Reference documents may be obtained by contacting your nearest Microchip sales
office (listed in the back of this document) or by downloading via the Microchip web site
(www.microchip.com). Recommended documents include:
• Individual data sheets and reference manuals:
- PIC16(L)F193X Data Sheet (DS41364)
- PIC18(L)F2X/4XK22 Data Sheet (DS41412)
- PIC16(L)F1826/27 Data Sheet (DS41391)
- PICmicro® Mid-Range MCU Family Reference Manual (DS33023)
- PICmicro®
18C MCU Family Reference Manual (DS39500)
- TC74 Data Sheet (DS21462)
• MPLAB® IDE Simulator, Editor User’s Guide (DS51025)
• MPASM™ Assembler, MPLINK™ Object Linker, MPLIB™ Object Librarian
User’s Guide (DS33014)
• PRO MATE® 3 User’s Guide (DS51464)
• MPLAB® IDE PICSTART® Plus User’s Guide (DS51028)
• MPLAB®
ICE Emulator User’s Guide (DS51159)
• MPLAB® ICD 3 In-Circuit Debugger Quick Start Guide (DS51766)
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 8  2011 Microchip Technology Inc.
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 C30 C compilers; MPASM™
and MPLAB ASM30 assemblers; MPLINK™ and MPLAB LINK30 object linkers;
and MPLIB™ and MPLAB LIB30 object librarians.
• Emulators – The latest information on Microchip in-circuit emulators.This
includes the MPLAB ICE 2000 and MPLAB ICE 4000.
• In-Circuit Debuggers – The latest information on the Microchip in-circuit
debugger, MPLAB ICD 2.
• MPLAB® 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®
II device programmers and the PICSTART®
Plus and PICkit™ 1 development programmers.
Preface
 2011 Microchip Technology Inc. DS41584A-page 9
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 (June 2011)
• Initial Release of this Document.
Note: This board (DM163022-1) has been updated from the previous version
(DM163022).The user guide for the previous board version (DM163022)
can be found online at the PICDEM 2 Plus web site (DS51275)
www.Microchip.com/PICDEM2PLUS.
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 10  2011 Microchip Technology Inc.
NOTES:
PICDEM™ 2 PLUS DEMONSTRATION
BOARD USER’S GUIDE
 2011 Microchip Technology Inc. DS41584A-page 11
Chapter 1. Introduction
1.1 INTRODUCTION
Thank you for purchasing the PICDEM™ 2 Plus Demonstration Board from Microchip
Technology Incorporated. The PICDEM 2 Plus Demonstration Board is a simple board
that demonstrates the capabilities of Microchip’s 8-bit, 18-, 28- and 40-pin PIC16FXXX,
PIC16F1XXX, and PIC18 devices.
The PICDEM 2 Plus Demonstration Board can be used stand-alone with a
programmed part, with an in-circuit emulator (for example, MPLAB®
REAL ICE™) or
with an in-circuit programmer/debugger (such as MPLAB®
ICD 3 or PICkit™ 3).
Sample programs are provided to demonstrate the unique features of the supported
devices.
1.2 DEVELOPMENT KIT CONTENTS
The PICDEM 2 Plus Demonstration Board kit comes with the following:
• PICDEM 2 Plus Demonstration Board (see Figure 1-1)
• Sample devices (pre-loaded with program demonstration)
If you are missing any part of the kit, please contact your nearest Microchip sales office
listed in the back of this publication for help.
1.3 PICDEM™ 2 PLUS DEMONSTRATION BOARD
The PICDEM 2 Plus Demonstration Board has the following hardware features:
1. 18-, 28- and 40-pin DIP sockets
(although three sockets are provided, only one device may be used at a time)
2. On-board, +5V regulator for direct input from 9V, 100 mA AC/DC wall adapter or
9V battery, or hooks for a +5V, 100 mA regulated DC supply
3. RS-232 socket and associated hardware for direct connection to an RS-232
interface
4. Programmer/debugger connectivity supporting MPLAB ICD 3, MPLAB REAL
ICE and PICkit 3
5. PICkit Serial Connector for analysis of serial communications peripherals such
as SPI or I2
C™
6. 5 k pot for devices with analog inputs
7. Three push button switches for external stimulus and Reset
8. Power-on indicator LED
9. Four LEDs connected to PORTB
10. On-board external oscillators including:
a) 4 MHz, canned crystal oscillator (Y2)
b) RC oscillator circuit (R4, C3)
c) Unpopulated holes for crystal connection (Y1)
d) 32.768 kHz crystal for Timer1 clock operation (Y3)
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 12  2011 Microchip Technology Inc.
11. 32K x 8 Serial EEPROM
12. LCD display
13. Piezo buzzer
14. Prototype area for user hardware
15. Expansion Header for PICtail™ daughter card connectivity or user access to
MCU pins
16. Microchip TC74 thermal sensor
FIGURE 1-1: PICDEM 2 PLUS DEMONSTRATION BOARD HARDWARE
:
:
MPICDEM™ 2 PLUS
DEMO BOARD
PICKIT
PICKIT
SERIAL
PWR
9V BATTERY
PICtail™
1
2
3
5

6
7
9
8
10
11
12
13
15
16
Introduction
 2011 Microchip Technology Inc. DS41584A-page 13
1.4 ON-BOARD JUMPER CONFIGURATIONS
Most of the on-board components have associated jumpers that will allow the user to
either connect or disconnect a component(s) from the PIC®
MCUs or other mounted
components. Table 1-1 and Figure 1-2 detail these connections.
FIGURE 1-2: PICDEM™ 2 PLUS DEMONSTRATION BOARD JUMPER
LOCATIONS
1.5 SAMPLE DEVICES
Two Flash devices are included. The device types may change, but will generally
include PIC16 and PIC18 40-pin, DIP devices.
TABLE 1-1: ON-BOARD JUMPER CONNECTIONS
Jumper Connection
J6 LEDs to PORTB
J7 On-board RC oscillator to PIC®
MCUs
J9 Piezo buzzer to RC2 pin (*on 40-pin mid-range device, this is CCP1)
J10 VCAP connection for devices with on-chip voltage regulator
J12 2.7V source to RA1 (voltage divider off of 9V input voltage)
J14, 15, 16, 17 PICkit™ Serial Header to I2
C™ bus
J18,19 Tx and Rx from RS-232 components to PIC MCUs
J20, 21, 22, 23 PIC MCUs to I2C bus
J24 RA4 pin to RC2 pin (*on 40-pin mid-range device, this connects C1OUT to
CCP1)
:
:
MPICDEM™ 2 PLUS
DEMO BOARD
PICKIT
PICKIT
SERIAL
PWR
9V BATTERY
J6
J7
J12
J19
J18
J14
J15
J16
J17
J20
J21
J23
J22
J9
J10
J24
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 14  2011 Microchip Technology Inc.
1.6 SAMPLE PROGRAMS
The PICDEM™ 2 Plus Demonstration Board kit sample demonstration programs can
be found on the Microchip web site (www.microchip.com/PICDEM2PLUS). These
programs may be used with the included sample devices, with a REAL ICE (In-Circuit
Emulator), MPLAB®
ICD 3 (programmer/debugger) or with a PICkit™ 3
(programmer/debugger). For each type of device (PIC16 or PIC18), demo source code
(several .C and .H files) and compiled code (one .hex file) are provided.
PICDEM™ 2 PLUS DEMONSTRATION
BOARD USER’S GUIDE
 2011 Microchip Technology Inc. DS41584A-page 15
Chapter 2. Getting Started
The PICDEM™ 2 Plus Demonstration Board may be used as a stand-alone board with
a preprogrammed device, with an In-Circuit Emulator (ICE), with an In-Circuit Debug-
ger (ICD) or with a PICkit™ programming device. For a list of PIC® microcontroller
compatible ICEs, ICDs or PICkit programming devices, see the Development Systems
Ordering Guide.
2.1 PICDEM™ 2 PLUS DEMONSTRATION BOARD AS A STAND-ALONE BOARD
– PREPROGRAMMED DEVICE
The PICDEM 2 Plus Demonstration Board may be demonstrated immediately by
following the steps listed below:
• Place the preprogrammed sample device in the appropriate socket on the
PICDEM 2 Plus Demonstration Board.
• Confirm the jumpers are populated/removed according to Table 2-1 below.
• Connect the programmer/debugger. See Section 2.2 “Programming the
Device”.
• Apply power to the PICDEM 2 Plus Demonstration Board. See
Section 2.3 “Powering the Board”.
TABLE 2-1: JUMPER SETUP
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 16  2011 Microchip Technology Inc.
To reprogram the sample device, the following will be necessary:
• Program source code – user source code may be used to program the device, or
if this previously has been done, the sample program may be restored from the
file included in the PICDEM 2 Plus installer.
• An assembler, such as MPASM™ assembler (available with MPLAB® IDE), or a
compiler, such as HI-TECH® C or MPLAB C18 (PIC18 devices only).
Source code must be assembled or compiled into a hex file before it can be pro-
grammed into the device. Microchip Technology’s MPASM assembler, HI-TECH or C18
C compilers may also be used. Both are compatible with MPLAB IDE.
Other assemblers/compilers may be used. For a list of these PIC MCU compatible lan-
guage tools, see the Microchip web site (www.microchip.com).
Once the sample program is in hex file format, a programmer can program a Flash
device. Microchip Technology’s PICkit or ICD 3 programmer may be used. Both are
compatible with MPLAB IDE.
Other programmers may be used. For a list of these PIC MCU compatible program-
mers, see the Microchip web site (www.microchip.com).
If the code protection bit(s) have not been programmed, the on-chip program memory
can be read out for verification purposes.
2.2 PROGRAMMING THE DEVICE
The PICDEM 2 Plus Demonstration Board supports the ability to program a device
through multiple options.
2.2.1 PICkit Programming
FIGURE 2-1: PICkit™ PROGRAMMER AND BOARD CONNECTION
HEADER
Microchip’s PICkit 3 In-Circuit Debugger/Programmer uses in-circuit debugging logic
incorporated into each chip with Flash memory to provide a low-cost hardware debug-
ger and programmer.
Getting Started
 2011 Microchip Technology Inc. DS41584A-page 17
Connecting the PICkit programmer to the PICDEM 2 Plus Demonstration Board is
quick and easy.
• First connect the PICkit 3 as shown in Figure 2-1.
• Make sure to connect the USB cable to the PICkit 3 and to the computer.
• Enter MPLAB and go to either the Debugger or Programmer tab. Select the
PICkit 3 as shown in Figure 2-2.
FIGURE 2-2: CONNECTING A PICkit PROGRAMMER
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 18  2011 Microchip Technology Inc.
2.2.2 ICD Programming
FIGURE 2-3: ICD PROGRAMMER AND BOARD CONNECTION HEADER
The MPLAB® ICD 3 In-Circuit Debugger System is Microchip’s most cost-effective,
high-speed hardware debugger/programmer for Microchip Flash Digital Signal Control-
ler (DSC) and microcontroller (MCU) devices. It debugs and programs PIC® Flash
microcontrollers and dsPIC® DSCs with the powerful, yet easy-to-use graphical user
interface of MPLAB Integrated Development Environment (IDE).
Connecting the ICD 3 to the PICDEM 2 Plus Demonstration Board is quick and easy.
• First connect the ICD 3 as shown in Figure 2-3.
• Make sure to connect the USB cable to the ICD 3 and to the computer.
• Enter MPLAB and go to either the Debugger or Programmer tab. Select the ICD
3 as shown in Figure 2-4.
Getting Started
 2011 Microchip Technology Inc. DS41584A-page 19
FIGURE 2-4: CONNECTING AN ICD
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 20  2011 Microchip Technology Inc.
2.3 POWERING THE BOARD
The PICDEM 2 Plus Demonstration Board supports the ability to power the board
through multiple options.
2.3.1 External 9V Connector
FIGURE 2-5: 9V EXTERNAL POWER SUPPLY
The PICDEM 2 Plus Demonstration Board can be powered with an external 9V power
supply.
• Connect 9V power supply to a wall outlet.
• Connect to board as shown in Figure 2-5. The on-board regulator will reduce the
input voltage to 5V for safe PIC device operation.
2.3.2 External 9V Battery
FIGURE 2-6: 9V EXTERNAL BATTERY
The PICDEM 2 Plus Demonstration Board can be powered with an external 9V battery
for a power supply.
• Connect the 9V battery to the board [B].
• The on-board regulator will reduce the input voltage to 5V for safe PIC device
operation.
Getting Started
 2011 Microchip Technology Inc. DS41584A-page 21
2.3.3 Power by Programmer
FIGURE 2-7: 5V SUPPLIED BY PROGRAMMER
The PICDEM 2 Plus Demonstration Board can also be powered with a PICkit or ICD
programming device.
• To power the device with a programmer go to either the Debuggger/Programmer
tab.
• Scroll down to Settings. Then go to the Power tab.
• Click the checkbox labeled “Power target circuit from MPLAB (programmer type)”.
Select 5V as the voltage.
• The board will now be powered through the programmer.
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 22  2011 Microchip Technology Inc.
NOTES:
PICDEM™ 2 PLUS DEMONSTRATION
BOARD USER’S GUIDE
 2011 Microchip Technology Inc. DS41584A-page 23
Chapter 3. Tutorial
The tutorial program is preprogrammed into the sample device. The PIC16 device’s
program was built using the HI-TECH C compiler and the PIC18 device’s program was
built using the C18 compiler. These programs are included in the PICDEM™ 2 Plus
installer file found at www.Microchip.com/PICDEM2PLUS.
In case the device has been reprogrammed to a user’s unique code, the device can
always be reprogrammed with the tutorial program if installed.
For detailed information on the PICDEM 2 Plus hardware, please refer to Appendix
A. “Hardware Detail”.
3.1 TUTORIAL PROGRAM OPERATION
The tutorial program is made up of four components, which are individually displayed
on the LCD.
3.1.1 Voltmeter
FIGURE 3-1: VOLTMETER DISPLAY AND COMPONENT
This mode uses the A/D module to measure the voltage of the RA0 pot (R16) and dis-
play a voltage between 0.00V and 5.00V on the LCD.
Voltage is continually updated until the mode is exited by pressing RB0.
FIGURE 3-2: TEMPERATURE READINGS
Reading the Voltmeter Display (ADC)
A) (ADRESH:ADRESL) ADC conversion result. Range: 10-bit (0-1023).
B) Voltage representation.
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 24  2011 Microchip Technology Inc.
3.1.2 Buzzer
FIGURE 3-3: BUZZER DISPLAY AND COMPONENT
This mode turns on the Piezo buzzer using the CCP1 module I/O pin, RC2.
FIGURE 3-4: FIGURE 3-4: BUZZER READINGS
The period and duty cycle of the CCP1 frequency can be changed while the buzzer is
on. The changes in period are recognized immediately in the buzzer tone. By changing
the period, the buzzer frequency changes.
• To change the period, press RB0 under the “Buzzer” menu.
• The buzzer will sound off with the default frequency of 10 kHz and a period of 05h
(0%).
• By pressing the RB4 button the period will increase by 5 (2%).
• The LCD will display the current Key being played by the buzzer based upon the
period.
• Press RB0 to exit the buzzer function.
Figure 3-3 shows an example of a signal supplied to the buzzer.
Reading the Buzzer Display (PWM)
A) PWM Period Percentage. Range (0-100%) Frequency (10 kHz-250 Hz).
- Please refer to Table 3-1 for a index of Period, PWM%, Frequency and Key.
B) This is the key being played based on the frequency being supplied to the speaker.
C) Increase the PWM period by 2%.
Tutorial
 2011 Microchip Technology Inc. DS41584A-page 25
FIGURE 3-5: BUZZER SIGNAL
TABLE 3-1: BUZZER INDEX
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 26  2011 Microchip Technology Inc.
3.1.3 Temperature
FIGURE 3-6: TEMPERATURE DISPLAY AND COMPONENT
This mode uses a TC74 thermal sensor to measure ambient temperature in Celsius
and then display the temperature on the LCD. The user has the option to change the
display between Celsius and Fahrenheit by pressing RB4.
Communication between the PIC MCU and sensor is accomplished using the MSSP
module. This mode is exited by pressing RB0.
FIGURE 3-7: TEMPERATURE READINGS
3.1.4 Temperature Fault
If during I2
C communication a time-out Fault occurs the LCD display will indicate the
Fault as shown in Figure 3-8.
FIGURE 3-8: TEMPERATURE COMMUNICATION FAULT
Reading the Temperature Display
A) Display current temperature at given unit of measurement
B) Change the unit of measurement.
Tutorial
 2011 Microchip Technology Inc. DS41584A-page 27
3.1.5 Clock
FIGURE 3-9: CLOCK DISPLAY
The Real-Time Clock will start counting from 00:00:00 at the start of the program.
The Timer1 module and a 32 kHz clock crystal are used to establish a Real-Time Clock.
By pressing RA4 within the clock function, the clock time can be set to the user’s pref-
erence. The user has the option to set the hours or minutes of the clock.
FIGURE 3-10: INCREMENT/DECREMENT HOURS
By pressing RA4 within the set function, the user can set the hours. The user first has
the option to increment the hours, one hour at a time by pressing RA4. If the user
presses RB0 within the increment hour’s function, the program will then allow the user
to decrement the hours, one hour at a time by pressing RA4. When the user presses
RB0 again the program will return to the clock display screen.
FIGURE 3-11: INCREMENT/DECREMENT MINUTES
By pressing RB0 within the set function, the user can set the minutes. The user first has
the option to increment the minutes, one minute at a time by pressing RA4. If the user
presses RB0 within the increment minute’s function, the program will then allow the
user to decrement the minutes, one minute at a time by pressing RA4. When the user
presses RB0 again the program will return to the clock display screen.
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 28  2011 Microchip Technology Inc.
3.1.6 USART
FIGURE 3-12: USART DATA IN HYPERTERMINAL
The data displayed on the LCD within all the program functions is also sent to the
RS-232 serial port using the USART on the PIC MCU. A HyperTerminal program on the
PC will be able to display the same information that is displayed on the LCD.
3.2 SOURCE CODE AND APPLICATION NOTES
In addition to the assembled tutorial program (hex files), source code used to create
these hex files are included in the PICDEM 2 Plus installer. Both source code and
related hex files are found in device-specific directories.
A digital guide is also included with the installer.
For information on how to reprogram the device with new or modified code, or how to
restore the tutorial program, please see Section 2.1 “PICDEM™ 2 Plus Demonstra-
tion Board as a Stand-Alone Board – Preprogrammed Device”.
Tutorial
 2011 Microchip Technology Inc. DS41584A-page 29
FIGURE 3-13: TUTORIAL PROGRAM FLOWCHART
Power-Up
PICDEM™ 2 Plus
Welcome Screen
Voltmeter
RA4 = Next
RB0 = Now
Buzzer
RA = Next
RB0 = Now
Temperature
RA4 = Next
RB0 = Now
Clock
RA4 = Next
RB0 = Now
Volts = 3.3V
[0681] RB0 = Exit
PWM:044% Key:C5
RA4 = +2% RB0 = Exit
USART
Transmit
Temp = 23° [C]
RA4 = [F] RB0 = Exit
Time 00:00:00
RA4 = Set RB0 = Menu
RA:[HR] 00:00:00
RB:[MIN] TIME
00:00:00 *[HRS]
RA:++/-- RB:Next
00:00:00 *[MIN]
RA:++/-- RB:Next
RB0
RB0
RB0
RB0
RA4
RB0 RB0 RB0
RA4
RA4
RA4
RA4
RA4
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 30  2011 Microchip Technology Inc.
NOTES:
PICDEM™ 2 PLUS DEMONSTRATION
BOARD USER’S GUIDE
 2011 Microchip Technology Inc. DS41584A-page 31
Appendix A. Hardware Detail
The PICDEM™ 2 Plus Demonstration Board hardware is extremely simple and illus-
trates the ease-of-use of various PIC MCUs. This section describes the PICDEM 2 Plus
Demonstration Board hardware elements.
A.1 PROCESSOR SOCKETS
Although three sockets are provided, only one device may be used at a time.
• 18-pin socket
• 28-pin socket
• 40-pin socket
A.2 DISPLAY
• Four green LEDs are connected to PORTB of each processor type.
• PORTB pins are set high to light the LEDs. These LEDs may be disconnected
from PORTB by removing jumper J6.
• One red LED is provided to indicate whether there is power to the PICDEM 2 Plus
Demonstration Board.
• LED On = Powered. LED Off = Not Powered
A.3 POWER SUPPLY
There are multiple ways to supply power to the PICDEM 2 Plus Demonstration Board:
• A 9V battery can be plugged into J8.
• A 9V, 100 mA unregulated AC or DC supply can be plugged into J2. A power sup-
ply can be purchased through Microchip, part #AC162039.
• A +5V, 100 mA regulated DC supply can be connected to the hooks provided.
MPLAB® ICE 2000 users have a regulated +5V power supply available in the logic
probe connector and can easily connect to the header (J4) on the PICDEM 2 Plus
Demonstration Board. (Red probe to +5V and Black probe to GND.)
MPLAB ICD or PICkit™ programmer users may use the programmer to power the tar-
get board to 5V, up to 200 mA, if the MPLAB programmer is connected to the PC.
A.4 RS-232 SERIAL PORT
An RS-232, level-shifting IC has been provided with all the necessary hardware to sup-
port connection of an RS-232 host through the DB9 connector. The port is configured
as DCE and can be connected to a PC using a straight-through cable.
The PIC16/PIC18 RX and TX pins are tied to the RX and TX lines of the MAX232A.
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 32  2011 Microchip Technology Inc.
A.5 SWITCHES
Three switches provide the following functions:
• S1 – MCLR to hard reset the processor
• S2 – Active-low switch connected to RA4
• S3 – Active-low switch connected to RB0
Switches S1 and S3 have debounced capacitors, where as S2 does not, allowing the
user to investigate debounced techniques.
When pressed, the switches are grounded. When idle, they are pulled high (+5V).
A.6 OSCILLATOR OPTIONS
• 32.768 kHz (watch-type) crystal for Timer1.
• Removable, 4 MHz, canned oscillator.
• Space for a user defined oscillator crystal.
A.7 ANALOG INPUT
A 5Ω potentiometer is connected through a series 470Ω resistor to AN0.
The pot can be adjusted from VDD to GND to provide an analog input to the parts with
an A/D module.
A.8 ICD CONNECTOR
By way of the modular connector (J5), the MPLAB ICD can be connected for low-cost
debugging. The ICD connector utilizes RB6 and RB7 of the microcontroller for in-circuit
debugging.
A.9 PICkit™ CONNECTOR
By way of the header connector (J11), the MPLAB PICkit can be connected for low-cost
debugging.
A.10 TEMPERATURE SENSOR
This is a serial digital thermal sensor (TC74) connected to the 28- and 40-pin microcon-
trollers via RC3 and RC4.
Communication is accomplished with the TC74 via its 2-wire I2C compatible serial port.
This device has an address of ‘0b1001101’.
A.11 SERIAL EEPROM
A 24L256 (32K x 8) serial EEPROM is included on the board to illustrate I2
C bus con-
cepts.
A.12 LCD
An LCD display with two lines, 16 characters each, is connecting to the 28 and 40-pin
sockets. There are three control lines (RA3:RA1) and four data lines (RD3:RD0).
A 5kΩ pot may be installed into R20 to adjust contrast on the LCD. If this is done, R5
and R6 need to be removed.
Hardware Detail
 2011 Microchip Technology Inc. DS41584A-page 33
A.13 SAMPLE DEVICES
A sample part programmed with a simple program is included in the PICDEM 2 Plus
Demonstration Board kit. Table A-1 lists the I/O features and port connections for each
processor type.
TABLE A-1: PORT CONNECTIONS
Device LEDs RS-232 S1 S2 S3
Pot
R16
LCD EEPROM Buzzer ICD
Temp
Sensor
Y1/Y2
18-pin RB3:RB0 N/A MCLR RA4 RB0 RA0 N/A N/A N/A RB6/RB7 N/A Yes
28-pin RB3:RB0 RC6/RC7 MCLR RA4 RB0 RA0 RC3/RC4 RA3:RA1 RC2 RB6/RB7 RC3/RC4 Yes
40-pin RB3:RB0 RC6/RC7 MCLR RA4 RB0 RA0 RC3/RC4 RA3:RA1
RD3:RD0
RC2 RB6/RB7 RC3/RC4 Yes
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 34  2011 Microchip Technology Inc.
A.14 BOARD LAYOUT AND SCHEMATICS
The following figures show the part layout (silkscreen) and schematics for the PICDEM
2 Plus Demonstration Board.
FIGURE A-1: PICDEM™ 2 PLUS DEMONSTRATION BOARD PARTS LAYOUT
Hardware Detail
 2011 Microchip Technology Inc. DS41584A-page 35
FIGURE A-2: PICDEM™ 2 PLUS DEMONSTRATION BOARD SCHEMATIC
PICDEM™ 2 Plus Demonstration Board User’s Guide
DS41584A-page 36  2011 Microchip Technology Inc.
FIGURE A-3: PICDEM™ 2 PLUS PIC16F1937 PINOUT
FIGURE A-4: PICDEM™ 2 PLUS PIC18F86K22 PINOUT
 2011 Microchip Technology Inc. DS41584A-page 37
PICDEM™ 2 Plus Demonstration Board User’ Guide
NOTES:
DS41584A-page 38  2011 Microchip Technology Inc.
AMERICAS
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://www.microchip.com/
support
Web Address:
www.microchip.com
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Cleveland
Independence, OH
Tel: 216-447-0464
Fax: 216-447-0643
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Indianapolis
Noblesville, IN
Tel: 317-773-8323
Fax: 317-773-5453
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Santa Clara
Santa Clara, CA
Tel: 408-961-6444
Fax: 408-961-6445
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
ASIA/PACIFIC
Asia Pacific Office
Suites 3707-14, 37th Floor
Tower 6, The Gateway
Harbour City, Kowloon
Hong Kong
Tel: 852-2401-1200
Fax: 852-2401-3431
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8569-7000
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
China - Chongqing
Tel: 86-23-8980-9588
Fax: 86-23-8980-9500
China - Hangzhou
Tel: 86-571-2819-3180
Fax: 86-571-2819-3189
China - Hong Kong SAR
Tel: 852-2401-1200
Fax: 852-2401-3431
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8203-2660
Fax: 86-755-8203-1760
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
China - Xian
Tel: 86-29-8833-7252
Fax: 86-29-8833-7256
China - Xiamen
Tel: 86-592-2388138
Fax: 86-592-2388130
China - Zhuhai
Tel: 86-756-3210040
Fax: 86-756-3210049
ASIA/PACIFIC
India - Bangalore
Tel: 91-80-3090-4444
Fax: 91-80-3090-4123
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
Japan - Yokohama
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
Malaysia - Kuala Lumpur
Tel: 60-3-6201-9857
Fax: 60-3-6201-9859
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
Taiwan - Hsin Chu
Tel: 886-3-6578-300
Fax: 886-3-6578-370
Taiwan - Kaohsiung
Tel: 886-7-213-7830
Fax: 886-7-330-9305
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
EUROPE
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
Worldwide Sales and Service
05/02/11

More Related Content

PDF
Microchip technology kit2 tutorial
PDF
Mplab user guide_51519c
PDF
Datasheet PIC16f887
PDF
16 f887
PDF
Pic 16f877a
PDF
PDF
PIC 16F87XA
Microchip technology kit2 tutorial
Mplab user guide_51519c
Datasheet PIC16f887
16 f887
Pic 16f877a
PIC 16F87XA

Similar to PICDEM2PlusUserGuide.pdf (20)

PDF
adc evaluation
PDF
Pic16f87x1a
PDF
Hitech picc manual
PDF
Pic16F887
PDF
819 data sheet
PDF
C18 manual
PDF
Pic18f4550
PDF
Datasheet pic 18f4550
PDF
Interfacing PIC Microcontrollers 2nd Edition Martin Bates
DOCX
Filterlab tutorial
PDF
Migracion del pic 16f628a al pic microchip 40048a.pdf
PPTX
Faster Time to Market using Scilab/XCOS/X2C for motor control algorithm devel...
PDF
PDF
DATA SHEET PIC12F675
PDF
C18 user guide_51288j
PDF
C18 user guide_51288j
PDF
PIC Microcontroller
PDF
16f84
adc evaluation
Pic16f87x1a
Hitech picc manual
Pic16F887
819 data sheet
C18 manual
Pic18f4550
Datasheet pic 18f4550
Interfacing PIC Microcontrollers 2nd Edition Martin Bates
Filterlab tutorial
Migracion del pic 16f628a al pic microchip 40048a.pdf
Faster Time to Market using Scilab/XCOS/X2C for motor control algorithm devel...
DATA SHEET PIC12F675
C18 user guide_51288j
C18 user guide_51288j
PIC Microcontroller
16f84
Ad

Recently uploaded (20)

PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PDF
Visual Aids for Exploratory Data Analysis.pdf
PDF
86236642-Electric-Loco-Shed.pdf jfkduklg
PDF
Soil Improvement Techniques Note - Rabbi
PDF
PPT on Performance Review to get promotions
PPT
A5_DistSysCh1.ppt_INTRODUCTION TO DISTRIBUTED SYSTEMS
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
UNIT 4 Total Quality Management .pptx
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PPTX
Information Storage and Retrieval Techniques Unit III
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
Nature of X-rays, X- Ray Equipment, Fluoroscopy
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Integrating Fractal Dimension and Time Series Analysis for Optimized Hyperspe...
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
R24 SURVEYING LAB MANUAL for civil enggi
Fundamentals of Mechanical Engineering.pptx
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
Exploratory_Data_Analysis_Fundamentals.pdf
Visual Aids for Exploratory Data Analysis.pdf
86236642-Electric-Loco-Shed.pdf jfkduklg
Soil Improvement Techniques Note - Rabbi
PPT on Performance Review to get promotions
A5_DistSysCh1.ppt_INTRODUCTION TO DISTRIBUTED SYSTEMS
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
UNIT 4 Total Quality Management .pptx
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Information Storage and Retrieval Techniques Unit III
Safety Seminar civil to be ensured for safe working.
Nature of X-rays, X- Ray Equipment, Fluoroscopy
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Integrating Fractal Dimension and Time Series Analysis for Optimized Hyperspe...
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
R24 SURVEYING LAB MANUAL for civil enggi
Ad

PICDEM2PlusUserGuide.pdf

  • 1.  2011 Microchip Technology Inc. DS41584A PICDEM™ 2 Plus Demonstration Board User’s Guide
  • 2. DS41584A-page 2  2011 Microchip Technology Inc. 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, dsPIC, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, PIC32 logo, rfPIC and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL 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, chipKIT, chipKIT logo, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, Omniscient Code Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode, Total Endurance, TSHARC, UniWinDriver, 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. © 2011, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. ISBN: 978-1-61341-248-0 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. 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® MCUs and dsPIC® DSCs, KEELOQ® code hopping 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.
  • 3. PICDEM™ 2 PLUS DEMONSTRATION BOARD USER’S GUIDE  2011 Microchip Technology Inc. DS41584A-page 3 Table of Contents Preface ........................................................................................................................... 5 Chapter 1. Introduction 1.1 Introduction ............................................................................................. 11 1.2 Development Kit Contents ...................................................................... 11 1.3 PICDEM™ 2 Plus Demonstration Board ................................................ 11 1.4 On-Board Jumper Configurations ........................................................... 13 1.5 Sample Devices ...................................................................................... 13 1.6 Sample Programs ................................................................................... 14 Chapter 2. Getting Started 2.1 PICDEM™ 2 Plus Demonstration Board as a Stand-Alone Board – Preprogrammed Device .......................................................................... 15 2.2 Programming the Device ........................................................................ 16 2.3 Powering the Board ................................................................................ 20 Chapter 3. Tutorial 3.1 Tutorial Program Operation .................................................................... 23 3.2 Source Code and Application Notes ....................................................... 28 Appendix A. Hardware Detail A.1 Processor Sockets .................................................................................. 31 A.2 Display .................................................................................................... 31 A.3 Power Supply ......................................................................................... 31 A.4 RS-232 Serial Port .................................................................................. 31 A.5 Switches ................................................................................................. 32 A.6 Oscillator Options ................................................................................... 32 A.7 Analog Input ........................................................................................... 32 A.8 ICD Connector ........................................................................................ 32 A.9 PICkit™ Connector ................................................................................. 32 A.10 Temperature Sensor ............................................................................... 32 A.11 Serial EEPROM ...................................................................................... 32 A.12 LCD ........................................................................................................ 32 A.13 Sample Devices ...................................................................................... 33 A.14 Board Layout and Schematics ................................................................ 34 Worldwide Sales and Service .................................................................................... 38
  • 4. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 4  2011 Microchip Technology Inc. NOTES:
  • 5. PICDEM™ 2 PLUS DEMONSTRATION BOARD USER’S GUIDE  2011 Microchip Technology Inc. DS41584A-page 5 Preface INTRODUCTION This chapter contains general information that will be useful to know before using the PICDEM™ 2 Plus Demonstration 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 the PICDEM™ 2 Plus Demonstration Board as a development tool to emulate and debug firmware on a target board. The manual layout is as follows: • Chapter 1. “Introduction” – Introduces the PICDEM 2 Plus Demonstration Board and provides a brief description of the hardware. • Chapter 2. “Getting Started” – Goes through a basic step-by-step process for getting your PICDEM 2 Plus Demonstration Board up and running as a stand-alone board or with an ICE, ICD or PICkit™ programmer. • Chapter 3. “Tutorial” – Provides a detailed description of the tutorial program. • Appendix A. “Hardware Detail” – Describes in detail the hardware of the PICDEM 2 Plus Demonstration Board. NOTICE TO CUSTOMERS All documentation becomes dated, and this manual is no exception. Microchip tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ from those in this document. Please refer to our web site (www.microchip.com) to obtain the latest documentation available. Documents are identified with a “DS” number. This number is located on the bottom of each page, in front of the page number. The numbering convention for the DS number is “DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the document. For the most up-to-date information on development tools, see the MPLAB® IDE on-line help. Select the Help menu, and then Topics to open a list of available online help files.
  • 6. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 6  2011 Microchip Technology Inc. CONVENTIONS USED IN THIS GUIDE This manual uses the following documentation conventions: DOCUMENTATION CONVENTIONS Description Represents Examples Arial font: Italic characters Referenced books MPLAB® IDE User’s Guide 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 “Save project before build” Underlined, italic text with right angle bracket A menu path File>Save Bold characters A dialog button Click OK A tab Click the Power tab N‘Rnnnn A number in verilog format, where N is the total number of digits, R is the radix and n is a digit. 4‘b0010, 2‘hF1 Text in angle brackets < > A key on the keyboard Press <Enter>, <F1> Courier New font: Plain Courier New Sample source code #define START Filenames autoexec.bat File paths c:mcc18h Keywords _asm, _endasm, static Command-line options -Opa+, -Opa- Bit values 0, 1 Constants 0xFF, ‘A’ Italic Courier New A variable argument file.o, where file can be any valid filename Square brackets [ ] Optional arguments mcc18 [options] file [options] Curly brackets and pipe character: { | } Choice of mutually exclusive arguments; an OR selection errorlevel {0|1} Ellipses... Replaces repeated text var_name [, var_name...] Represents code supplied by user void main (void) { ... }
  • 7. Preface  2011 Microchip Technology Inc. DS41584A-page 7 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 PICDEM™ 2 Plus Demonstration Board. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources. Readme for PICDEM™ 2 Plus Demonstration Board For the latest information on using the PICDEM™ 2 Plus Demonstration Board, read the “Readme for PICDEM™ 2 Plus Demonstration Board.txt” file (an ASCII text file) in the Readmes subdirectory of the MPLAB IDE installation directory. The Readme file contains update information and known issues that may not be included in this user’s guide. Readme Files For the latest information on using other tools, read the tool-specific Readme files in the Readmes subdirectory of the MPLAB IDE installation directory. The Readme files contain update information and known issues that may not be included in this user’s guide. Reference Documents Reference documents may be obtained by contacting your nearest Microchip sales office (listed in the back of this document) or by downloading via the Microchip web site (www.microchip.com). Recommended documents include: • Individual data sheets and reference manuals: - PIC16(L)F193X Data Sheet (DS41364) - PIC18(L)F2X/4XK22 Data Sheet (DS41412) - PIC16(L)F1826/27 Data Sheet (DS41391) - PICmicro® Mid-Range MCU Family Reference Manual (DS33023) - PICmicro® 18C MCU Family Reference Manual (DS39500) - TC74 Data Sheet (DS21462) • MPLAB® IDE Simulator, Editor User’s Guide (DS51025) • MPASM™ Assembler, MPLINK™ Object Linker, MPLIB™ Object Librarian User’s Guide (DS33014) • PRO MATE® 3 User’s Guide (DS51464) • MPLAB® IDE PICSTART® Plus User’s Guide (DS51028) • MPLAB® ICE Emulator User’s Guide (DS51159) • MPLAB® ICD 3 In-Circuit Debugger Quick Start Guide (DS51766)
  • 8. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 8  2011 Microchip Technology Inc. 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 C30 C compilers; MPASM™ and MPLAB ASM30 assemblers; MPLINK™ and MPLAB LINK30 object linkers; and MPLIB™ and MPLAB LIB30 object librarians. • Emulators – The latest information on Microchip in-circuit emulators.This includes the MPLAB ICE 2000 and MPLAB ICE 4000. • In-Circuit Debuggers – The latest information on the Microchip in-circuit debugger, MPLAB ICD 2. • MPLAB® 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® II device programmers and the PICSTART® Plus and PICkit™ 1 development programmers.
  • 9. Preface  2011 Microchip Technology Inc. DS41584A-page 9 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 (June 2011) • Initial Release of this Document. Note: This board (DM163022-1) has been updated from the previous version (DM163022).The user guide for the previous board version (DM163022) can be found online at the PICDEM 2 Plus web site (DS51275) www.Microchip.com/PICDEM2PLUS.
  • 10. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 10  2011 Microchip Technology Inc. NOTES:
  • 11. PICDEM™ 2 PLUS DEMONSTRATION BOARD USER’S GUIDE  2011 Microchip Technology Inc. DS41584A-page 11 Chapter 1. Introduction 1.1 INTRODUCTION Thank you for purchasing the PICDEM™ 2 Plus Demonstration Board from Microchip Technology Incorporated. The PICDEM 2 Plus Demonstration Board is a simple board that demonstrates the capabilities of Microchip’s 8-bit, 18-, 28- and 40-pin PIC16FXXX, PIC16F1XXX, and PIC18 devices. The PICDEM 2 Plus Demonstration Board can be used stand-alone with a programmed part, with an in-circuit emulator (for example, MPLAB® REAL ICE™) or with an in-circuit programmer/debugger (such as MPLAB® ICD 3 or PICkit™ 3). Sample programs are provided to demonstrate the unique features of the supported devices. 1.2 DEVELOPMENT KIT CONTENTS The PICDEM 2 Plus Demonstration Board kit comes with the following: • PICDEM 2 Plus Demonstration Board (see Figure 1-1) • Sample devices (pre-loaded with program demonstration) If you are missing any part of the kit, please contact your nearest Microchip sales office listed in the back of this publication for help. 1.3 PICDEM™ 2 PLUS DEMONSTRATION BOARD The PICDEM 2 Plus Demonstration Board has the following hardware features: 1. 18-, 28- and 40-pin DIP sockets (although three sockets are provided, only one device may be used at a time) 2. On-board, +5V regulator for direct input from 9V, 100 mA AC/DC wall adapter or 9V battery, or hooks for a +5V, 100 mA regulated DC supply 3. RS-232 socket and associated hardware for direct connection to an RS-232 interface 4. Programmer/debugger connectivity supporting MPLAB ICD 3, MPLAB REAL ICE and PICkit 3 5. PICkit Serial Connector for analysis of serial communications peripherals such as SPI or I2 C™ 6. 5 k pot for devices with analog inputs 7. Three push button switches for external stimulus and Reset 8. Power-on indicator LED 9. Four LEDs connected to PORTB 10. On-board external oscillators including: a) 4 MHz, canned crystal oscillator (Y2) b) RC oscillator circuit (R4, C3) c) Unpopulated holes for crystal connection (Y1) d) 32.768 kHz crystal for Timer1 clock operation (Y3)
  • 12. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 12  2011 Microchip Technology Inc. 11. 32K x 8 Serial EEPROM 12. LCD display 13. Piezo buzzer 14. Prototype area for user hardware 15. Expansion Header for PICtail™ daughter card connectivity or user access to MCU pins 16. Microchip TC74 thermal sensor FIGURE 1-1: PICDEM 2 PLUS DEMONSTRATION BOARD HARDWARE : : MPICDEM™ 2 PLUS DEMO BOARD PICKIT PICKIT SERIAL PWR 9V BATTERY PICtail™ 1 2 3 5 6 7 9 8 10 11 12 13 15 16
  • 13. Introduction  2011 Microchip Technology Inc. DS41584A-page 13 1.4 ON-BOARD JUMPER CONFIGURATIONS Most of the on-board components have associated jumpers that will allow the user to either connect or disconnect a component(s) from the PIC® MCUs or other mounted components. Table 1-1 and Figure 1-2 detail these connections. FIGURE 1-2: PICDEM™ 2 PLUS DEMONSTRATION BOARD JUMPER LOCATIONS 1.5 SAMPLE DEVICES Two Flash devices are included. The device types may change, but will generally include PIC16 and PIC18 40-pin, DIP devices. TABLE 1-1: ON-BOARD JUMPER CONNECTIONS Jumper Connection J6 LEDs to PORTB J7 On-board RC oscillator to PIC® MCUs J9 Piezo buzzer to RC2 pin (*on 40-pin mid-range device, this is CCP1) J10 VCAP connection for devices with on-chip voltage regulator J12 2.7V source to RA1 (voltage divider off of 9V input voltage) J14, 15, 16, 17 PICkit™ Serial Header to I2 C™ bus J18,19 Tx and Rx from RS-232 components to PIC MCUs J20, 21, 22, 23 PIC MCUs to I2C bus J24 RA4 pin to RC2 pin (*on 40-pin mid-range device, this connects C1OUT to CCP1) : : MPICDEM™ 2 PLUS DEMO BOARD PICKIT PICKIT SERIAL PWR 9V BATTERY J6 J7 J12 J19 J18 J14 J15 J16 J17 J20 J21 J23 J22 J9 J10 J24
  • 14. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 14  2011 Microchip Technology Inc. 1.6 SAMPLE PROGRAMS The PICDEM™ 2 Plus Demonstration Board kit sample demonstration programs can be found on the Microchip web site (www.microchip.com/PICDEM2PLUS). These programs may be used with the included sample devices, with a REAL ICE (In-Circuit Emulator), MPLAB® ICD 3 (programmer/debugger) or with a PICkit™ 3 (programmer/debugger). For each type of device (PIC16 or PIC18), demo source code (several .C and .H files) and compiled code (one .hex file) are provided.
  • 15. PICDEM™ 2 PLUS DEMONSTRATION BOARD USER’S GUIDE  2011 Microchip Technology Inc. DS41584A-page 15 Chapter 2. Getting Started The PICDEM™ 2 Plus Demonstration Board may be used as a stand-alone board with a preprogrammed device, with an In-Circuit Emulator (ICE), with an In-Circuit Debug- ger (ICD) or with a PICkit™ programming device. For a list of PIC® microcontroller compatible ICEs, ICDs or PICkit programming devices, see the Development Systems Ordering Guide. 2.1 PICDEM™ 2 PLUS DEMONSTRATION BOARD AS A STAND-ALONE BOARD – PREPROGRAMMED DEVICE The PICDEM 2 Plus Demonstration Board may be demonstrated immediately by following the steps listed below: • Place the preprogrammed sample device in the appropriate socket on the PICDEM 2 Plus Demonstration Board. • Confirm the jumpers are populated/removed according to Table 2-1 below. • Connect the programmer/debugger. See Section 2.2 “Programming the Device”. • Apply power to the PICDEM 2 Plus Demonstration Board. See Section 2.3 “Powering the Board”. TABLE 2-1: JUMPER SETUP
  • 16. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 16  2011 Microchip Technology Inc. To reprogram the sample device, the following will be necessary: • Program source code – user source code may be used to program the device, or if this previously has been done, the sample program may be restored from the file included in the PICDEM 2 Plus installer. • An assembler, such as MPASM™ assembler (available with MPLAB® IDE), or a compiler, such as HI-TECH® C or MPLAB C18 (PIC18 devices only). Source code must be assembled or compiled into a hex file before it can be pro- grammed into the device. Microchip Technology’s MPASM assembler, HI-TECH or C18 C compilers may also be used. Both are compatible with MPLAB IDE. Other assemblers/compilers may be used. For a list of these PIC MCU compatible lan- guage tools, see the Microchip web site (www.microchip.com). Once the sample program is in hex file format, a programmer can program a Flash device. Microchip Technology’s PICkit or ICD 3 programmer may be used. Both are compatible with MPLAB IDE. Other programmers may be used. For a list of these PIC MCU compatible program- mers, see the Microchip web site (www.microchip.com). If the code protection bit(s) have not been programmed, the on-chip program memory can be read out for verification purposes. 2.2 PROGRAMMING THE DEVICE The PICDEM 2 Plus Demonstration Board supports the ability to program a device through multiple options. 2.2.1 PICkit Programming FIGURE 2-1: PICkit™ PROGRAMMER AND BOARD CONNECTION HEADER Microchip’s PICkit 3 In-Circuit Debugger/Programmer uses in-circuit debugging logic incorporated into each chip with Flash memory to provide a low-cost hardware debug- ger and programmer.
  • 17. Getting Started  2011 Microchip Technology Inc. DS41584A-page 17 Connecting the PICkit programmer to the PICDEM 2 Plus Demonstration Board is quick and easy. • First connect the PICkit 3 as shown in Figure 2-1. • Make sure to connect the USB cable to the PICkit 3 and to the computer. • Enter MPLAB and go to either the Debugger or Programmer tab. Select the PICkit 3 as shown in Figure 2-2. FIGURE 2-2: CONNECTING A PICkit PROGRAMMER
  • 18. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 18  2011 Microchip Technology Inc. 2.2.2 ICD Programming FIGURE 2-3: ICD PROGRAMMER AND BOARD CONNECTION HEADER The MPLAB® ICD 3 In-Circuit Debugger System is Microchip’s most cost-effective, high-speed hardware debugger/programmer for Microchip Flash Digital Signal Control- ler (DSC) and microcontroller (MCU) devices. It debugs and programs PIC® Flash microcontrollers and dsPIC® DSCs with the powerful, yet easy-to-use graphical user interface of MPLAB Integrated Development Environment (IDE). Connecting the ICD 3 to the PICDEM 2 Plus Demonstration Board is quick and easy. • First connect the ICD 3 as shown in Figure 2-3. • Make sure to connect the USB cable to the ICD 3 and to the computer. • Enter MPLAB and go to either the Debugger or Programmer tab. Select the ICD 3 as shown in Figure 2-4.
  • 19. Getting Started  2011 Microchip Technology Inc. DS41584A-page 19 FIGURE 2-4: CONNECTING AN ICD
  • 20. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 20  2011 Microchip Technology Inc. 2.3 POWERING THE BOARD The PICDEM 2 Plus Demonstration Board supports the ability to power the board through multiple options. 2.3.1 External 9V Connector FIGURE 2-5: 9V EXTERNAL POWER SUPPLY The PICDEM 2 Plus Demonstration Board can be powered with an external 9V power supply. • Connect 9V power supply to a wall outlet. • Connect to board as shown in Figure 2-5. The on-board regulator will reduce the input voltage to 5V for safe PIC device operation. 2.3.2 External 9V Battery FIGURE 2-6: 9V EXTERNAL BATTERY The PICDEM 2 Plus Demonstration Board can be powered with an external 9V battery for a power supply. • Connect the 9V battery to the board [B]. • The on-board regulator will reduce the input voltage to 5V for safe PIC device operation.
  • 21. Getting Started  2011 Microchip Technology Inc. DS41584A-page 21 2.3.3 Power by Programmer FIGURE 2-7: 5V SUPPLIED BY PROGRAMMER The PICDEM 2 Plus Demonstration Board can also be powered with a PICkit or ICD programming device. • To power the device with a programmer go to either the Debuggger/Programmer tab. • Scroll down to Settings. Then go to the Power tab. • Click the checkbox labeled “Power target circuit from MPLAB (programmer type)”. Select 5V as the voltage. • The board will now be powered through the programmer.
  • 22. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 22  2011 Microchip Technology Inc. NOTES:
  • 23. PICDEM™ 2 PLUS DEMONSTRATION BOARD USER’S GUIDE  2011 Microchip Technology Inc. DS41584A-page 23 Chapter 3. Tutorial The tutorial program is preprogrammed into the sample device. The PIC16 device’s program was built using the HI-TECH C compiler and the PIC18 device’s program was built using the C18 compiler. These programs are included in the PICDEM™ 2 Plus installer file found at www.Microchip.com/PICDEM2PLUS. In case the device has been reprogrammed to a user’s unique code, the device can always be reprogrammed with the tutorial program if installed. For detailed information on the PICDEM 2 Plus hardware, please refer to Appendix A. “Hardware Detail”. 3.1 TUTORIAL PROGRAM OPERATION The tutorial program is made up of four components, which are individually displayed on the LCD. 3.1.1 Voltmeter FIGURE 3-1: VOLTMETER DISPLAY AND COMPONENT This mode uses the A/D module to measure the voltage of the RA0 pot (R16) and dis- play a voltage between 0.00V and 5.00V on the LCD. Voltage is continually updated until the mode is exited by pressing RB0. FIGURE 3-2: TEMPERATURE READINGS Reading the Voltmeter Display (ADC) A) (ADRESH:ADRESL) ADC conversion result. Range: 10-bit (0-1023). B) Voltage representation.
  • 24. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 24  2011 Microchip Technology Inc. 3.1.2 Buzzer FIGURE 3-3: BUZZER DISPLAY AND COMPONENT This mode turns on the Piezo buzzer using the CCP1 module I/O pin, RC2. FIGURE 3-4: FIGURE 3-4: BUZZER READINGS The period and duty cycle of the CCP1 frequency can be changed while the buzzer is on. The changes in period are recognized immediately in the buzzer tone. By changing the period, the buzzer frequency changes. • To change the period, press RB0 under the “Buzzer” menu. • The buzzer will sound off with the default frequency of 10 kHz and a period of 05h (0%). • By pressing the RB4 button the period will increase by 5 (2%). • The LCD will display the current Key being played by the buzzer based upon the period. • Press RB0 to exit the buzzer function. Figure 3-3 shows an example of a signal supplied to the buzzer. Reading the Buzzer Display (PWM) A) PWM Period Percentage. Range (0-100%) Frequency (10 kHz-250 Hz). - Please refer to Table 3-1 for a index of Period, PWM%, Frequency and Key. B) This is the key being played based on the frequency being supplied to the speaker. C) Increase the PWM period by 2%.
  • 25. Tutorial  2011 Microchip Technology Inc. DS41584A-page 25 FIGURE 3-5: BUZZER SIGNAL TABLE 3-1: BUZZER INDEX
  • 26. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 26  2011 Microchip Technology Inc. 3.1.3 Temperature FIGURE 3-6: TEMPERATURE DISPLAY AND COMPONENT This mode uses a TC74 thermal sensor to measure ambient temperature in Celsius and then display the temperature on the LCD. The user has the option to change the display between Celsius and Fahrenheit by pressing RB4. Communication between the PIC MCU and sensor is accomplished using the MSSP module. This mode is exited by pressing RB0. FIGURE 3-7: TEMPERATURE READINGS 3.1.4 Temperature Fault If during I2 C communication a time-out Fault occurs the LCD display will indicate the Fault as shown in Figure 3-8. FIGURE 3-8: TEMPERATURE COMMUNICATION FAULT Reading the Temperature Display A) Display current temperature at given unit of measurement B) Change the unit of measurement.
  • 27. Tutorial  2011 Microchip Technology Inc. DS41584A-page 27 3.1.5 Clock FIGURE 3-9: CLOCK DISPLAY The Real-Time Clock will start counting from 00:00:00 at the start of the program. The Timer1 module and a 32 kHz clock crystal are used to establish a Real-Time Clock. By pressing RA4 within the clock function, the clock time can be set to the user’s pref- erence. The user has the option to set the hours or minutes of the clock. FIGURE 3-10: INCREMENT/DECREMENT HOURS By pressing RA4 within the set function, the user can set the hours. The user first has the option to increment the hours, one hour at a time by pressing RA4. If the user presses RB0 within the increment hour’s function, the program will then allow the user to decrement the hours, one hour at a time by pressing RA4. When the user presses RB0 again the program will return to the clock display screen. FIGURE 3-11: INCREMENT/DECREMENT MINUTES By pressing RB0 within the set function, the user can set the minutes. The user first has the option to increment the minutes, one minute at a time by pressing RA4. If the user presses RB0 within the increment minute’s function, the program will then allow the user to decrement the minutes, one minute at a time by pressing RA4. When the user presses RB0 again the program will return to the clock display screen.
  • 28. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 28  2011 Microchip Technology Inc. 3.1.6 USART FIGURE 3-12: USART DATA IN HYPERTERMINAL The data displayed on the LCD within all the program functions is also sent to the RS-232 serial port using the USART on the PIC MCU. A HyperTerminal program on the PC will be able to display the same information that is displayed on the LCD. 3.2 SOURCE CODE AND APPLICATION NOTES In addition to the assembled tutorial program (hex files), source code used to create these hex files are included in the PICDEM 2 Plus installer. Both source code and related hex files are found in device-specific directories. A digital guide is also included with the installer. For information on how to reprogram the device with new or modified code, or how to restore the tutorial program, please see Section 2.1 “PICDEM™ 2 Plus Demonstra- tion Board as a Stand-Alone Board – Preprogrammed Device”.
  • 29. Tutorial  2011 Microchip Technology Inc. DS41584A-page 29 FIGURE 3-13: TUTORIAL PROGRAM FLOWCHART Power-Up PICDEM™ 2 Plus Welcome Screen Voltmeter RA4 = Next RB0 = Now Buzzer RA = Next RB0 = Now Temperature RA4 = Next RB0 = Now Clock RA4 = Next RB0 = Now Volts = 3.3V [0681] RB0 = Exit PWM:044% Key:C5 RA4 = +2% RB0 = Exit USART Transmit Temp = 23° [C] RA4 = [F] RB0 = Exit Time 00:00:00 RA4 = Set RB0 = Menu RA:[HR] 00:00:00 RB:[MIN] TIME 00:00:00 *[HRS] RA:++/-- RB:Next 00:00:00 *[MIN] RA:++/-- RB:Next RB0 RB0 RB0 RB0 RA4 RB0 RB0 RB0 RA4 RA4 RA4 RA4 RA4
  • 30. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 30  2011 Microchip Technology Inc. NOTES:
  • 31. PICDEM™ 2 PLUS DEMONSTRATION BOARD USER’S GUIDE  2011 Microchip Technology Inc. DS41584A-page 31 Appendix A. Hardware Detail The PICDEM™ 2 Plus Demonstration Board hardware is extremely simple and illus- trates the ease-of-use of various PIC MCUs. This section describes the PICDEM 2 Plus Demonstration Board hardware elements. A.1 PROCESSOR SOCKETS Although three sockets are provided, only one device may be used at a time. • 18-pin socket • 28-pin socket • 40-pin socket A.2 DISPLAY • Four green LEDs are connected to PORTB of each processor type. • PORTB pins are set high to light the LEDs. These LEDs may be disconnected from PORTB by removing jumper J6. • One red LED is provided to indicate whether there is power to the PICDEM 2 Plus Demonstration Board. • LED On = Powered. LED Off = Not Powered A.3 POWER SUPPLY There are multiple ways to supply power to the PICDEM 2 Plus Demonstration Board: • A 9V battery can be plugged into J8. • A 9V, 100 mA unregulated AC or DC supply can be plugged into J2. A power sup- ply can be purchased through Microchip, part #AC162039. • A +5V, 100 mA regulated DC supply can be connected to the hooks provided. MPLAB® ICE 2000 users have a regulated +5V power supply available in the logic probe connector and can easily connect to the header (J4) on the PICDEM 2 Plus Demonstration Board. (Red probe to +5V and Black probe to GND.) MPLAB ICD or PICkit™ programmer users may use the programmer to power the tar- get board to 5V, up to 200 mA, if the MPLAB programmer is connected to the PC. A.4 RS-232 SERIAL PORT An RS-232, level-shifting IC has been provided with all the necessary hardware to sup- port connection of an RS-232 host through the DB9 connector. The port is configured as DCE and can be connected to a PC using a straight-through cable. The PIC16/PIC18 RX and TX pins are tied to the RX and TX lines of the MAX232A.
  • 32. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 32  2011 Microchip Technology Inc. A.5 SWITCHES Three switches provide the following functions: • S1 – MCLR to hard reset the processor • S2 – Active-low switch connected to RA4 • S3 – Active-low switch connected to RB0 Switches S1 and S3 have debounced capacitors, where as S2 does not, allowing the user to investigate debounced techniques. When pressed, the switches are grounded. When idle, they are pulled high (+5V). A.6 OSCILLATOR OPTIONS • 32.768 kHz (watch-type) crystal for Timer1. • Removable, 4 MHz, canned oscillator. • Space for a user defined oscillator crystal. A.7 ANALOG INPUT A 5Ω potentiometer is connected through a series 470Ω resistor to AN0. The pot can be adjusted from VDD to GND to provide an analog input to the parts with an A/D module. A.8 ICD CONNECTOR By way of the modular connector (J5), the MPLAB ICD can be connected for low-cost debugging. The ICD connector utilizes RB6 and RB7 of the microcontroller for in-circuit debugging. A.9 PICkit™ CONNECTOR By way of the header connector (J11), the MPLAB PICkit can be connected for low-cost debugging. A.10 TEMPERATURE SENSOR This is a serial digital thermal sensor (TC74) connected to the 28- and 40-pin microcon- trollers via RC3 and RC4. Communication is accomplished with the TC74 via its 2-wire I2C compatible serial port. This device has an address of ‘0b1001101’. A.11 SERIAL EEPROM A 24L256 (32K x 8) serial EEPROM is included on the board to illustrate I2 C bus con- cepts. A.12 LCD An LCD display with two lines, 16 characters each, is connecting to the 28 and 40-pin sockets. There are three control lines (RA3:RA1) and four data lines (RD3:RD0). A 5kΩ pot may be installed into R20 to adjust contrast on the LCD. If this is done, R5 and R6 need to be removed.
  • 33. Hardware Detail  2011 Microchip Technology Inc. DS41584A-page 33 A.13 SAMPLE DEVICES A sample part programmed with a simple program is included in the PICDEM 2 Plus Demonstration Board kit. Table A-1 lists the I/O features and port connections for each processor type. TABLE A-1: PORT CONNECTIONS Device LEDs RS-232 S1 S2 S3 Pot R16 LCD EEPROM Buzzer ICD Temp Sensor Y1/Y2 18-pin RB3:RB0 N/A MCLR RA4 RB0 RA0 N/A N/A N/A RB6/RB7 N/A Yes 28-pin RB3:RB0 RC6/RC7 MCLR RA4 RB0 RA0 RC3/RC4 RA3:RA1 RC2 RB6/RB7 RC3/RC4 Yes 40-pin RB3:RB0 RC6/RC7 MCLR RA4 RB0 RA0 RC3/RC4 RA3:RA1 RD3:RD0 RC2 RB6/RB7 RC3/RC4 Yes
  • 34. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 34  2011 Microchip Technology Inc. A.14 BOARD LAYOUT AND SCHEMATICS The following figures show the part layout (silkscreen) and schematics for the PICDEM 2 Plus Demonstration Board. FIGURE A-1: PICDEM™ 2 PLUS DEMONSTRATION BOARD PARTS LAYOUT
  • 35. Hardware Detail  2011 Microchip Technology Inc. DS41584A-page 35 FIGURE A-2: PICDEM™ 2 PLUS DEMONSTRATION BOARD SCHEMATIC
  • 36. PICDEM™ 2 Plus Demonstration Board User’s Guide DS41584A-page 36  2011 Microchip Technology Inc. FIGURE A-3: PICDEM™ 2 PLUS PIC16F1937 PINOUT FIGURE A-4: PICDEM™ 2 PLUS PIC18F86K22 PINOUT
  • 37.  2011 Microchip Technology Inc. DS41584A-page 37 PICDEM™ 2 Plus Demonstration Board User’ Guide NOTES:
  • 38. DS41584A-page 38  2011 Microchip Technology Inc. AMERICAS Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://www.microchip.com/ support Web Address: www.microchip.com Atlanta Duluth, GA Tel: 678-957-9614 Fax: 678-957-1455 Boston Westborough, MA Tel: 774-760-0087 Fax: 774-760-0088 Chicago Itasca, IL Tel: 630-285-0071 Fax: 630-285-0075 Cleveland Independence, OH Tel: 216-447-0464 Fax: 216-447-0643 Dallas Addison, TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills, MI Tel: 248-538-2250 Fax: 248-538-2260 Indianapolis Noblesville, IN Tel: 317-773-8323 Fax: 317-773-5453 Los Angeles Mission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608 Santa Clara Santa Clara, CA Tel: 408-961-6444 Fax: 408-961-6445 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699 Fax: 905-673-6509 ASIA/PACIFIC Asia Pacific Office Suites 3707-14, 37th Floor Tower 6, The Gateway Harbour City, Kowloon Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431 Australia - Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China - Beijing Tel: 86-10-8569-7000 Fax: 86-10-8528-2104 China - Chengdu Tel: 86-28-8665-5511 Fax: 86-28-8665-7889 China - Chongqing Tel: 86-23-8980-9588 Fax: 86-23-8980-9500 China - Hangzhou Tel: 86-571-2819-3180 Fax: 86-571-2819-3189 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 China - Nanjing Tel: 86-25-8473-2460 Fax: 86-25-8473-2470 China - Qingdao Tel: 86-532-8502-7355 Fax: 86-532-8502-7205 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 China - Wuhan Tel: 86-27-5980-5300 Fax: 86-27-5980-5118 China - Xian Tel: 86-29-8833-7252 Fax: 86-29-8833-7256 China - Xiamen Tel: 86-592-2388138 Fax: 86-592-2388130 China - Zhuhai Tel: 86-756-3210040 Fax: 86-756-3210049 ASIA/PACIFIC India - Bangalore Tel: 91-80-3090-4444 Fax: 91-80-3090-4123 India - New Delhi Tel: 91-11-4160-8631 Fax: 91-11-4160-8632 India - Pune Tel: 91-20-2566-1512 Fax: 91-20-2566-1513 Japan - Yokohama Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Korea - Daegu Tel: 82-53-744-4301 Fax: 82-53-744-4302 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 Malaysia - Kuala Lumpur Tel: 60-3-6201-9857 Fax: 60-3-6201-9859 Malaysia - Penang Tel: 60-4-227-8870 Fax: 60-4-227-4068 Philippines - Manila Tel: 63-2-634-9065 Fax: 63-2-634-9069 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 Taiwan - Hsin Chu Tel: 886-3-6578-300 Fax: 886-3-6578-370 Taiwan - Kaohsiung Tel: 886-7-213-7830 Fax: 886-7-330-9305 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 Thailand - Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 EUROPE Austria - Wels Tel: 43-7242-2244-39 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 France - Paris Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Germany - Munich Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Netherlands - Drunen Tel: 31-416-690399 Fax: 31-416-690340 Spain - Madrid Tel: 34-91-708-08-90 Fax: 34-91-708-08-91 UK - Wokingham Tel: 44-118-921-5869 Fax: 44-118-921-5820 Worldwide Sales and Service 05/02/11