Microchip Technology Low Pin Count Demo Board User’s Guide

Low Pin Count Demo Board
User’s Guide
© 2005 Microchip Technology Inc. DS51556A
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 Digit al Millennium Copyright Act. If suc h a c t s allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WAR­RANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of M icrochip’s prod ucts as critical components in life support systems is not authorized except with express written approval by Microchip. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron, dsPIC, K
EELOQ, microID, MPLAB, PIC, PICmicro, PICSTART,
PRO MATE, PowerSmart, rfPIC, and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB, PICMASTER, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, dsPICDEM, dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, Linear Active Thermistor, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo, PowerMate, PowerTool, rfLAB, rfPICD EM, Select Mode, Smart Serial, SmartTel, Total Endurance and WiperLock are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their respective companies.
© 2005, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received ISO/TS-16949:2002 quality system certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona and Mountain View, California in October 2003. The Company’s quality system processes and procedures are for its PICmicro devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.
®
8-bit MCUs, KEELOQ
®
code hopping
DS51556A-page ii © 2005 Microchip Technology Inc.
LOW PIN COUNT DEMO BOARD
USER’S GUIDE
Tabl e of Conten ts
Preface ...........................................................................................................................1
Chapter 1. Low Pin Count (LPC) Demo Board Overview
1.1 Introduction ..................................................................................................... 7
1.2 Highlight s .................... .. ............. .. .............. .. .. ............. ... ............. .. .. ............. ... 7
1.3 Devices S u pp o rted by the LPC D e mo Board .................... ............. .. .............. 7
1.4 LPC Demo B o a rd O verview ...................... .. ............. .. .............. .. ............. .. ..... 8
1.5 Running the PICkit™ 2 Flash Starter Kit Default Demonstration ................... 8
Chapter 2. Mid-Range PICmicro® Architectural Overvie w
2.1 Introduction ..................................................................................................... 9
2.2 Memory Organization ...................................................................................10
2.3 Instruct io n fo rma ts ...... .. ............. .. .............. .. .. ............. ... ............. .. .. ............. . 10
2.3.1 Assembler Basics ......................................................................................11
Chapter 3. LPC Demo Board Lessons
3.1 Introduction ................................................................................................... 13
3.2 LPC Demo B o a rd le ss o n s ................ ............. .. .............. .. ............. .. ............. . 13
3.2.1 Lesson 1: Hello World (Light a LED) .......................................................................14
3.2.2 Lesson 2: Delay Loop (Blink a LED) ....................................................................... 15
3.2.3 Lesson 3: Rotate (Move the LED) ...........................................................................17
3.2.4 Lesson 4: Analog-to-Digital .....................................................................................19
3.2.5 Lesson 5: Variable Speed Rotate ...........................................................................22
3.2.6 Lesson 6: Switch Debouncing ................................................................................23
3.2.7 Lesson 7: Reversible Variable Speed Rotate ......................................................... 25
3.2.8 Lesson 8: Function Calls ........................................................................................26
3.2.9 Lesson 9: Timer0 ....................................................................................................27
3.2.10 Lesson 10: Interrupts ............................................................................................29
3.2.11 Lesson 11: Indirect Data Addressing ....................................................................31
3.2.12 Lesson 12: Look-up Table (ROM Array) ...............................................................33
Appendix A. Hardware Schematics
A.1 Introduction .................................................................................................. 37
Worldwide Sales and Service ....................................................................................38
© 2005 Microchip Technology Inc. DS51556A-page iii
Low Pin Count Demo Board User’s Guide
NOTES:
DS51556A-page iv © 2005 Microchip Technology Inc.
LOW PIN COUNT DEMO
BOARD USER’S GUIDE

Preface

NOTICE TO CUSTOMERS
All documentation becomes dated, and this manual is no exception. Microchip tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ from those in this document. Please refer to our web site (www.microchip.com) to obtain the latest documentation available.
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 Low Pin Count (LPC) Demo Board. Items discussed in this chapter include:
• About this Guide
• Warranty Registration
• Recommended Reading
• Troubleshooting
• The Microchip Web Site
• Development Systems Customer Notification Service
• Customer Support
DOCUMENT LAYOUT
This document describes how to use the Low Pin Count Demo Board User’s Guide as a development tool to emulate and debug firmware on a target board. The manual layout is as follows:
Chapter 1. “Low Pin Count (LPC) Demo Board Overview” – An overview of Microchip’s Low Pin Count Demo Board.
Chapter 2. “Mid-Ra nge PICm icro the Mid-range PICmicro
Chapter 3. “ LPC Demo Boa rd Lesso ns” – Contains a variety of lessons that demonstrate how to utilize and experiment with the Low Pin Count Demo Board.
®
Architecture.
®
Architectural Overview” – An overview of
© 2005 Microchip Technology Inc. DS51556A-page 1
Low Pin Count Demo Board User’s Guide
CONVENTIONS USED IN THIS GUIDE
This manual uses the following docum entat io n conven tion s:
DOCUMENTATION CONVENTIONS
Description Represents Examples
Arial font:
Italic characters Referenced books MPLAB
Emphasized text ...is the only comp ile r...
Initial caps A window the Output window
A dialog the Settings dialog A menu selection select Enable Programmer
Quotes A field name in a window or
dialog
Underlined, italic text with right angle bracket
Bold characters A dialog button Click OK
N‘Rnnnn A number in verilog format,
Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>
Courier font:
Plain Courier Sample source code #define START
Italic Courier A variable argument file.o, where file can be
Square brackets [ ] Optional arguments mcc18 [options] file
Curly brackets and pipe character: { | }
Ellipses... Replaces r epeated text var_name [,
A menu path File>Save
A tab Click the Power tab
where N is the tota l number of digits, R is th e radi x and n is a digit.
Filenames autoexec.bat File paths c:\mcc18\h Keywords _asm, _endasm, static Command-line options -Opa+, -Opa- Bit values 0, 1 Constants 0xFF, ‘A’
Choice of mutually exclusive arguments; an OR selection
Represents code supplied by user
“Save project before build”
4‘b0010, 2‘hF1
any valid filename
[options] errorlevel {0|1}
var_name...] void main (void)
{ ... }
®
IDE User’s Guide
DS51556A-page 2 © 2005 Microchip Technology Inc.
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 the Low Pin Count (LPC) Demo Board. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources.
Readme for Low Pin Count (LPC) Demo Board
For the latest information on using the Low Pin Count (LPC) Demo Board, read the “Readme for Low Pin Count Demo Board.txt” file (an ASCII text file) in the PICkit 2 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.
PICkit™ 2 Microcontroller Programmer User’s Guide (DS51553)
Consult this document for instr ucti ons on how to use the PICkit2 Microcontroller Programmer hardware and software.
PIC16F685/687/689/690 Data Sheet (DS41262)
Consult this document for information regarding the PIC16F685/687/689/690 20-pin Flash based, 8-bit CMOS Microcontroller device specifications.
MPLAB
Consult this document for more information pertaining to the installation and features of the MPLAB Integrated Development Environment (IDE) Software.
®
IDE, Simulator, Editor User’s Guide (DS51025)
Preface
© 2005 Microchip Technology Inc. DS51556A-page 3
Low Pin Count Demo Board User’s Guide
THE MICROCH IP WEB SITE
Microchip provides online support via our web site at www.microchip.com. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site contains the following information:
Product Support – Data sheets and errata, application notes and sample programs, design resources, user’s guides and hardware support documents, latest software releases and archived software
General Technical Support – Frequently Asked Questions (FAQs), technical support requests, online discussion groups, Microchip consultant program member listin g
Business of Microchip – Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives
DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE
Microchip’s customer notification service helps keep customers current on Microchip products. Subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest.
To register, access the Microchip web site at www.microchip.com, click on Customer Change Notification and follow the registration instructions.
The Development Systems product group categories are:
Compilers – The latest information on Microchip C compilers and other language tools. These include 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
®
IDE – The latest information on Microchip MPLAB IDE, the Windows®
®
®
1 development programmers.
II device programmers and the PICSTART®
DS51556A-page 4 © 2005 Microchip Technology Inc.
CUSTOMER SUPPORT
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
• Development Systems Information Line Customers should contact their distributor, representative or field application engineer
(FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in the back of this document.
Technical support is available through the web site at: http://support.microchip.com In additi on, t her e is a De velo pment Sys tem s In form at ion Li ne w hic h lis t s th e la tes t ve r-
sions of Microchip’s development systems software products. This line also provides information on how customers can receive currently available upgrade kits.
The Development Systems Information Line numbers are: 1-800-755-2345 – United States and most of Canada 1-480-792-7302 – Other Interna tio nal Loca tio ns
Preface
DOCUMENT REVISION HISTORY
Revision A (May 2005)
• Initial Release of this Document.
© 2005 Microchip Technology Inc. DS51556A-page 5
Low Pin Count Demo Board User’s Guide
NOTES:
DS51556A-page 6 © 2005 Microchip Technology Inc.
LOW PIN COUNT DEMO BOARD
USER’S GUIDE

Chapter 1. Low Pin Count (LPC) Demo Board Overview

1.1 INTRODUCTION

This chapter introduces the Low Pin Count (LPC) Demo Board and describes the LPC Demo Board features.

1.2 HIGHLIGHTS

This chapter discusses:
• Devices supported by the LPC Demo Board
• The LPC Demo Board Overview
• Running the PICkit™ 2 Starter Kit Default Demonstration

1.3 DEVICES SUPPORTED BY THE LPC DEMO BOARD

For a list of supported devices, see the LPC Demo Board README file on the PICkit™ 2 Starter Kit CD-ROM.
8-pin DIP Flash Devices:
PIC12F508 PIC12F629 PIC12F635 PIC12F509 PIC12F675 PIC12F683 PIC12F510
14-pin DIP Flash Devices:
PIC16F505 PIC16F630 PIC16F684 PIC16F506 PIC16F676 PIC16F688
20-pin DIP Flash Devices:
PIC16F685 PIC16F689 PIC16F785 PIC16F687 PIC16F690
© 2005 Microchip Technology Inc. DS51556A-page 7
Low Pin Count Demo Board User’s Guide
r

1.4 LPC DEMO BOARD OVERVIEW

The Low Pin Count Demo Board Works with the PICkit™ 2 Microcontroller Programmer to help the user get up to speed quickly using PICmicro This user’s guide is written in the form of Lessons intended for a person with some exposure to assembly language but has never used a PICmicro
The LPC Demo Board overview is shown in Figure 1-1.

FIGURE 1-1: LPC DEMO BOARD

®
microcontr ollers.
®
microcontroller.
PICkit™ 2 Programming Header
14-pin Expansion
Header
20-pin
DIP Socket
Generous
Prototyping
Area
Potentiomete
Push Button
LEDs

1.5 RUNNING THE PICkit 2 STARTER KIT DEFAULT DEMONSTRATION

The Low Pin Count Demo Board comes preprogrammed with a demonstration program. To use this program, connect the PICkit™ 2 Starter Kit to the PC’s USB port using the USB cable. Start the PICkit™ 2 Microcontroller Programmer application and check the target power box. The demo program will blink the four red lights in succession. Press the Push Button Switch, labeled SW1, and the sequence of the lights will reverse. Rotate the potentiometer , labeled RP1, and th e light sequence will blink at a different rate. This demo program is developed through the first 7 lessons in this guide.
DS51556A-page 8 © 2005 Microchip Technology Inc.
LOW PIN COUNT DEMO BOARD
USER’S GUIDE

Chapter 2. Mid-Range PICmicro® Architectural Overview

2.1 INTRODUCTION

This chapt er describes the Mid-range PICmicro® Architectural Overview for the LPC Demo Board.
FIGURE 2-1: SIMPLIFIED MID-RANGE PICmicro
INT
13
Program Counter
8-Level Stack (13-bit)
Direct Addr
7
Program
Bus
OSC1/CLKI
OSC2/CLKO
Flash
4k x 14
Program
Memory
14
Instruction Reg
8
Instruction
Decode and
Control
Timing
Generation
®
BLOCK DIAGRAM
Data Bus
RAM
256 bytes
File
Registers
RAM Addr
9
Addr MUX
8
FSR Reg
Status Reg
3
8
MUX
ALU
W Reg
8
Indirect
Addr
Internal
Oscillator
Block
© 2005 Microchip Technology Inc. DS51556A-page 9
Loading...
+ 29 hidden pages