Note the following details of the code protection feature on Microchip devices:
•Microchip products meet the specification contained in their particular Microchip Data Sheet.
•Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
•Microchip is willing to work with the customer who is concerned about the integrity of their code.
•Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, K
EELOQ, KEELOQ logo, MPLAB, PIC, PICmicro,
PICSTART, PRO MATE, rfPIC and SmartShunt are registered
trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
FilterLab, Linear Active Thermistor, MXDEV, MXLAB,
SEEVAL, SmartSensor and The Embedded Control Solutions
Company are registered trademarks of Microchip Technology
Incorporated in the U.S.A.
logo, PowerCal, PowerInfo,
PowerMate, PowerTool, REAL ICE, rfLAB, Select Mode, Total
Endurance, UNI/O, WiperLock and ZENA are trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
All documentation becomes dated, and this manual is no exception. Microchip tools and
documentation are constantly evolving to meet customer needs, so some actual dialogs
and/or tool descriptions may differ from those in this document. Please refer to our web site
(www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each
page, in front of the page number. The numbering convention for the DS number is
“DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the
document.
For the most up-to-date information on development tools, see the MPLAB
Select the Help menu, and then Topics to open a list of available on-line help files.
®
IDE on-line help.
INTRODUCTION
This chapter contains general information that will be useful to know before using the
PIC18F4XK20 Starter Kit. Items discussed in this chapter include:
• Document Layout
• Conventions Used in this Guide
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
• Customer Support
• Document Revision History
DOCUMENT LAYOUT
This document describes how to use the PIC18F4XK20 Starter Kit as a development
tool to emulate and debug firmware on a target board. The manual layout is as follows:
This user's guide describes how to use the PIC18F4XK20 Starter Kit. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources.
PIC18F46K20 Data Sheet (DS41303)
This data sheet summarizes the features of the PIC18F46K20. It provides essential
information needed to develop software for this device.
MCP9700/9700A and MCP9701/9701A Data Sheet (DS21942)
This data sheet summarizes the features of the MCP9700/9700A and
MCP9701/9701A. It provides essential information needed to develop software for
these devices.
MCP001/2/4 Data Sheet (DS21733)
This data sheet summarizes the features of the MCP001/2/4. It provides essential
information needed to develop software for these devices.
25LC1024 Data Sheet (DS22064)
This data sheet summarizes the features of the 25LC1024. It provides essential
information needed to develop software for this device.
Preface
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
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™ 1 development programmers.
®
IDE – The latest information on Microchip MPLAB IDE, the Windows®
®
II device programmers and the PICSTART®
CUSTOMER SUPPORT
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
Customers should contact their distributor, representative or field application engineer
(FAE) for support. Local sales offices are also available to help customers. A listing of
sales offices and locations is included in the back of this document.
Technical support is available through the web site at: http://support.microchip.com
The PIC18F4XK20 Starter Kit is a demonstration and development tool designed for
those getting started with microcontrollers or those looking to migrate to the new
PIC18F4XK20/2XK20 family. The board is designed for general purpose applications
and includes a variety of hardware to exercise microcontroller peripherals.
1.1OVERVIEW
The PIC18F4XK20/2XK20 is a new family of microcontrollers that take advantage of
Microchip’s latest process technology. Among the most notable of the new features are:
• lower power consumption
• high-performance operation and
•low-cost
Several firmware demos that showcase some of the features are included, as well as
a PICkit™ 2 Development Programmer, which can be used to download the demos
onto the development board.
The hardware included on the board allows for development as well. The microcontroller
that is populated on the board, the PIC18F46K20, is the superset of the PIC18F4XK20/2XK20
family. Included on the board are various analog and digital circuitry used in
microcontroller applications, in addition to a header which breaks out all signal lines for
analysis or interfacing to external devices.
PIC18F4XK20 STARTER KIT
USER’S GUIDE
1.2HIGHLIGHTS
This chapter discusses the features of the PIC18F4XK20 Starter Kit. Topics discussed
include:
• PIC18F4XK20 Starter Kit Contents
• PIC18F4XK20 System Management Layout
• Powering the Demo Board
• Quick Start Guide
• Programming Lessons
1.3PIC18F4XK20 STARTER KIT CONTENTS
The PIC18F4XK20 Starter Kit includes the following items:
If you are missing any part of the kit, please contact your nearest Microchip sales office
listed on the back of this publication.
1.4PIC18F4XK20 STARTER KIT LAYOUT
The PIC18F4XK20 Starter Kit Board is populated with a PIC18F46K20 microcontroller.
In addition, the board is also populated with the following features/components:
• 128x64 Organic LED Display (SPI)
• 32.768 kHz External Oscillator (Timer1)
• Analog Input Filtering and Gain Control into RE1 (1.4.1)
• PWM Output Filtering from RC2 (1.4.2)
• 4 Push Buttons for User Interfacing
•1 MCLR
• 8 LEDs mapped to PORTD
• Potentiometer
• 1024 KB Serial EEPROM
• PICtail™ daughter board header (breaks out all pins)
The analog filtering circuit is designed for use with an electret microphone. Electret
microphones typically require biasing, which is provided by MIC bias jumper, JP3. The
analog signal generated by a typical electret microphone has a peak to peak voltage in
the single millivolts range. The analog filtering circuit has a maximum gain of 300 which
can be controlled with the potentiometer labeled GAIN and is a 2nd order low-pass filter
with a cut-off frequency of 5 kHz. Jumper JP3 needs to be removed if the analog input
is provided by input test point.
1.4.2PWM Filtering from RC2
The microcontroller output RC2 provides an active low pass filter that can be used to
generate analog signals. A high frequency PWM output from RC2 can be pulse width
modulated to vary the amplitude of the output signal.
1.4.3PICtail Daughter Board Interface
The PICtail daughter board interface breaks out each pin of the microcontroller in
addition to providing +V
existing PICtail daughter boards. Visit the Microchip web site to find more details on
PICtail daughter boards.
1.4.4PICkit Serial Analyzer Connector
DD and ground. The header is designed to be compatible with
The PICkit serial analyzer connector provides pins for serial communication. The serial
communications lines are designed to be used with the PICkit serial analyzer, but are
also provided for general purpose communications as well.
The Serial Communications
pinout is shown below:
FIGURE 1-2:SERIAL COMMUNICATIONS PIN-OUT
1
TX
23
+5V
456
SDA
G
ND
SCLRX
1.4.5ICSP™ (In-Circuit Serial Programmer™) Connector
A 6-pin ICSP programming capability and RJ-11 connectors are provided for
programming the microcontroller. The PIC18F46K20 can be programmed through
these connectors using the PICkit 2 programmer in the MPLAB ICD 2.
Note:The programming voltage on the microcontroller VPP pin must be below 9V
according to the programming specification. Protection circuitry (8.2V
Zener with 820 Ohm series resistor) is in place to ensure that V
exceed programming specifications.
An MCP9700 temperature sensor is located on the board. The MCP9700 is an analog
temperature sensor that provides a linear voltage output versus temperature. The
voltage output of the temperature sensor is connected to the RE1 pin of the microcontroller
1.4.725LC1024 Serial EEPROM
A Microchip 1024 Kbit serial reprogrammable Flash memory with both Flash and
byte-level serial EEPROM functions is provided.
The memory is accessed via a simple Serial Peripheral Interface (SPI) compatible
serial bus. The bus signals are a clock input plus separate data in and data out lines.
Access to the device is controlled by a Chip Select (CS) input on the microcontroller pin
RA6.
1.4.832.768 kHz Crystal
The 32.768 kHz tuning fork crystal is interfaced to the RC0/T1OSO and RC1/T1OSI
pins for use with the Timer1 peripheral.
1.4.9128x64 OLED
The display provided on the development board is a 128x64 organic LED display. It
interfaces to the microcontroller via Serial Peripheral Interface (SPI). The controller on
the OLED is the SH1101A.
.
1.5POWERING THE DEMO BOARD
The demonstration board can be powered in the following ways:
1. The board accepts a 2.5mm coaxial power connector in J3. Acceptable voltages
range from +5-12 V
2. The PICkit 2 Development programmer can be used to provide power at connector P1. Do not exceed current of 100 mA on the board if the PICkit 2 is being
used to power the board.
3. The PICkit Serial Analyzer can be used to provide power at connector P2. Do
not exceed a current of 100 mA on the board if the PICkit Serial Analyzer is being
used to power the board.
DC.
1.6QUICK START GUIDE
The PIC18F4XK20 Starter Kit is preloaded with demonstration firmware. The board
must be configured as described in this section in order to usethe demonstration programs
Board Setup
1. Close jumper JP1 labeled Current Jumper, JP3 labeled Mic Bias and JP2.
2. Connect a +5-12V power supply to connector J3 in the upper left portion of the
board.
1.6.1Downloading Demonstration Software
The PIC18F4XK20 Starter Kit CD-ROM comes with 3 demonstration programs and 12
hands-on programming lessons. Using the PICkit 2 Development Programmer, demonstration firmware can be downloaded onto the demo board and the board can be
powered.
10. Click Programmer > Release from Reset to release the M
program.
1.7PROGRAMMING LESSONS
CLR to run the
The PIC18F4XK20 CD-ROM includes a variety of programming lessons designed for
use with the demonstration board. Insert the PIC18F4XK20 CD-ROM and browse to
the Lessons directory of the CD-ROM.
This chapter describes common problems when using the PIC18F4XK20
Demonstration Board and their solutions.
2.1.1The board does not power up.
Make sure that the green POWER LED has turned on. If the LED is not on, check to
see that the +9V power supply is properly connected.
2.1.2Microcontroller is not executing code.
First check to make sure that the microcontroller has been programmed with the firmware that is intended to run. If the part is programmed, ensure that the current jumper
JP1 is in place.
2.1.3The microcontroller will not program.
Check to make sure that the programmer/debugger is properly connected to the PC
and powered. Make sure that the board is also powered with the +9V power supply.
Programming can only occur when the current jumper JP1 is connected.