B
B
B
DS51721B
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 Microchips 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 Microchips 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 buyers 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, KEELOQ, 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. Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, In-Circuit Serial Programming, ICSP, ICEPIC, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, PICkit, PICDEM, PICDEM.net, PICtail, PIC32 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. 2008, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper.
Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Companys 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, Microchips quality system for the design and manufacture of development systems is ISO 9001:2000 certified.
DS51721B-page ii
DS51721B-page iii
DS51721B-page iv
INTRODUCTION
This chapter contains general information that will be useful to know before using the PICDEM PIC18 Explorer 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 PIC18 Explorer Demonstration Board as a development tool to emulate and debug firmware on a target board. The manual layout is as follows: Chapter 1. Introduction Overview of the development board and kit Chapter 2. Getting Started Description of the different ways to use the board Chapter 3. PICDEM PIC18 Explorer Demonstration Board Tutorial Program Explanation of the tutorial preprogrammed on the sample devices Appendix A. Hardware Details Description of the boards hardware elements, including layout and schematic drawings
DS51721B-page 1
Quotes Underlined, italic text with right angle bracket Bold characters
NRnnnn
Text in angle brackets < > Courier New font: Plain Courier New
Press <Enter>, <F1> #define START autoexec.bat c:\mcc18\h _asm, _endasm, static -Opa+, -Opa0, 1 0xFF, A file.o, where file can be any valid filename mcc18 [options] file [options] errorlevel {0|1} var_name [, var_name...] void main (void) { ... }
Italic Courier New Square brackets [ ] Curly brackets and pipe character: { | } Ellipses...
DS51721B-page 2
Preface
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 users guide describes how to use the PICDEM PIC18 Explorer Demonstration Board. Other useful documents are listed below. On the board kits CD-ROM: - Readme file - Other reference documents Other documents, available at http://microchip.com: - MPLAB ICD 2 In-Circuit Debugger Users Guide (DS51331) - PICkit 2 Programmer/Debugger Users Guide (DS51553) - Microchip Development Systems Ordering Guide (DS30177)
DS51721B-page 3
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.
DS51721B-page 4
1.2
DS51721B-page 5
DS51721B-page 6
Introduction
FIGURE 1-1: PICDEM PIC18 EXPLORER DEMONSTRATION BOARD
5 6 2 1 29 28 27 26
3 7 8 9 10 25
24
11
12 13 14 15 16 17 18 19 20 21 22 23
1.4
SAMPLE DEVICES
The PICDEM PIC18 Explorer Demonstration Board comes with two sample devices that alternately can be used as the main microcontroller: An 18-pin, 5V PIC microcontroller (the PIC18F8722) mounted on the board A 3.3V PIC18 device (PIC18F87J11) mounted on an 80-pin PIM that connects to the demo board via an 80-pin male
1.5
SAMPLE PROGRAMS
The PICDEM PIC18 Explorer Demonstration Board Kit includes a CD-ROM with sample demonstration programs. These programs may be used with the included sample devices and with an In-Circuit Debugger (ICD). Also provided on the disc is demonstration source code that includes several assembly source code (ASM) files and one Hex compiled code file.
DS51721B-page 7
DS51721B-page 8
PICDEM PIC18 EXPLORER DEMONSTRATION BOARD USERS GUIDE Chapter 2. Getting Started
The PICDEM PIC18 Explorer Demonstration Board may be used in a variety of ways. Table 2-1 lists the three primary configurations and the required equipment and capabilities of each. TABLE 2-1: PICDEM PIC18 EXPLORER DEMONSTRATION BOARD CONFIGURATIONS
Board Connections Board Capabilities Access boards full functionality Demonstrate sample code Display functionality with LCD or LEDs Connect ICD/programmer for debugging or programming Connect PICtail daughter cards Access boards full functionality Demonstrate sample code Develop and debug code Reprogram microcontrollers Connect PICtail daughter cards
Configuration
Stand-alone board
Power supply
Power supply In-Circuit Debugger (ICD) that also can be used as a programmer
Power supply Board with alternate microcontroller, attached ICD that also can be used as a through a Plug-In Module programmer (PIM) PIM with mounted microcontroller
Substitute PIM-mounted device as main microcontroller Use 3.3V or 5V devices as main microcontroller Demonstrate sample code Develop and debug code Reprogram microcontrollers Connect PICtail daughter cards
PIM enables 80, 64, 44 and 28-pin devices to be used as the main microcontroller. For information on the available PIMs, go to http://microchip.com.
This chapter describes: How to implement each of the uses described in Table 2-1 How to reprogram the main and RS-232 to USB microcontrollers How to connect the demonstration board to a host PC for RS-232 communication
2.1
DS51721B-page 9
To immediately implement the PICDEM PIC18 Explorer Demonstration Board to demonstrate the PIC18F8722 microcontroller: 1. Designate the mounted, PIC18F8722 device as the boards main microcontroller by moving Switch S4 to PIC MCU, as shown in Figure 2-1. FIGURE 2-1: S4 SWITCH SETTING FOR DEFAULT MAIN MICROCONTROLLER Switch Position
PIC MCU
Switch Location
S4 Switch
S4
ICE
2. Enable the LEDs by placing a jumper on JP1, as shown in Figure 2-2. FIGURE 2-2: JP1, JP2 AND JP3 JUMPERS
3. Enable the EEPROM and the LCD by placing a jumper on JP2 and JP3, as shown in Figure 2-2. 4. Apply power to the board. For information on acceptable power sources, see Appendix A. Hardware Details. The device now can be demonstrated using the tutorial program. (See Section 3.1 Tutorial Program Operation.)
DS51721B-page 10
Getting Started
2.1.2 Reprogramming the Microcontroller
Either or both the main PIC18F8722 microcontroller and RS-232-USB, or the PIC18LF2450 microcontroller, can be reprogrammed for running the board as a stand-alone device. To implement this usage: 1. Reprogram either or both devices, as described in Section 2.4 Programming the Microcontrollers. 2. Disconnect the programming devices. 3. Follow the procedure given in Section 2.1.1 Using the Board As Is.
2.2
For information on other microcontroller compatible ICD or ICE devices, see the Microchip Development Systems Ordering Guide or the Microchip web site at http://microchip.com.
DS51721B-page 11
The PIM enables the attachment of 80, 64, 44 or 28-pin devices. Some PIMs also enable the boards 5V output to be automatically reset to 3.3V. For a list of microcontroller-compatible PIMs, see the Microchip Development Systems Ordering Guide (DS30177) or go to http://microchip.com.
DS51721B-page 12
Getting Started
2.3.1 Attaching the PIM
To attach the PIM: 1. Seat the PIM in the 80-pin, elevated, male connectors that encircle the PIC18F8722 (see Figure 2-5). FIGURE 2-5: PIM CONNECTORS AND S4 SWITCH
PIM Connectors
S4 Switch
Alternately, an In-Circuit Emulator (ICE) can be attached to the male connectors. This enables in-circuit emulation and user development and debugging of code. For information on this use, see the Microchip web site (http://microchip.com). 2. To designate the PIM-mounted device as the main microcontroller, set Switch S4 (shown in Figure 2-5) to ICE (see Figure 2-6). FIGURE 2-6: S4 SWITCH SETTING FOR PIM-MOUNTED DEVICES
PIC MCU S4
ICE
3. If you are converting from the boards default VDD of 5V, see Varying the Device Voltage (5V/3.3V) on page 14.
DS51721B-page 13
By default, the PICDEM PIC18 Explorer Demonstration Boards VDD supply is 5V. The VDD can be varied, for PIM-mounted microcontrollers, from 5 to 3.3V to accommodate devices running at 5 or 3.3V. This VDD is named VAR. The PICDEM PIC18 Explorer Demonstration Board enables the voltage change with PIM connection headers and a variable voltage regulator. PIMs mounted with 3.3V devices implement the voltage change through two resistors with values that produce the desired voltage. (See Calculating Other VDD Values on page 15.) The voltage varying hardware includes: An adjustable voltage regulator, the LM317 Located on the board, left of the PIM connectors and marked as U2 (recognizable by the TO-220 package commonly used for transistors) Header J2 Located above the PIM connectors Resistors R25 and R26 Located below jumper J13 Resistors R101 and R102 Located on the PIM board In setting the boards voltage: For the default, 5V voltage - For board-mounted PIC18F8722 device: Board resistor R25 = 1 k Board resistor R26 = 330 - For a PIM-mounted, 5V microcontroller: Board resistors R25 and R26 Same values of 1 k and 330, respectively PIM-mounted resistors R101 and R102 Unpopulated For 3.3V VDD (achieved only with a PIM with a mounted 3.3V device, such as the PIC18F87J11) - Header J2 goes into the PIM board where resistors R101 and R102 are inserted in parallel to the board resistors R25 and R26 - PIM board resistor R101 can be unpopulated - PIM board resistor R102 can be 1.18 k. Note: For precise adjustment of VDD, 1% resistors are recommended.
DS51721B-page 14
Getting Started
2.3.3 Calculating Other VDD Values
Other VDD values can be produced by the LM317 adjustable voltage regulator by populating the PIM boards R101 and R102 with different value resistors. A brief overview follows, on how to calculate alternate values for these resistors. For detailed information, see the LM317 data sheet. EQUATION 2-1: REGULATOR VOLTAGE OUTPUT
R2 V OUT = V REF 1 + ------ + I ADJ R2 R1
IADJ is minimized by the LM317, so it can be assumed to be zero, or very small. VREF is the reference voltage developed by the LM317 between the output and adjustment terminal and equals 1.25V. That produces the equations shown in Equation 2-2. EQUATION 2-2: CALCULATING OUTPUT VOLTAGE
R2 V OUT = 1.25V 1 + ------ R1 ( R25 R102 ) R2 = R25 || R102 = --------------------------------( R25 + R102 ) ( R26 R101 ) R1 = R26 || R101 = --------------------------------( R26 + R101 )
As stated previously, R25 = 1 k, and R26 = 330. Without R102 and R101 being inserted in parallel on the PIM board, VOUT =1.25V(1+ 1 k/330) = 5.04V. To calculate a desired VOUT: 1. Solve for R2, given R1 = R26 = 330. 2. Now knowing R2 and R25, solve for R102. 3. Determine the nearest available resistor value for R102 and recalculate the resulting VDD to make sure it does not exceed the maximum VDD for the part you will be using. Table 2-2 shows the R101 and R102 resistor values to use for different VDD values. The table assumes that the PICDEM PIC18 Explorer Demonstration Boards R25 and R26 resistors are left at their default values of 1K and 330, respectively. TABLE 2-2:
VDD 5V 3.6V 3.3V 3.0V
This table assumes that the PICDEM PIC18 Explorer Demonstration Boards R25 and R26 resistors are left at their default values of 1 k and 330, respectively.
DS51721B-page 15
2.4.1
Programming Requirements
To reprogram a sample device, the following is required: Program source code Sample code is preloaded on the device, but user source code can be substituted. If this is done, the sample program can be restored using the file on the board kits CD-ROM. An assembler or compiler Source code must be assembled or compiled into a Hex file before it can be programmed into the device. A programmer Once the code is in the Hex file format, this device programs the microcontrollers Flash memory. If the code protection bit(s) have not been programmed, the on-chip program memory can be read out for verification purposes. In meeting these requirements: Code development and debugging The free MPLAB IDE software development tool includes a debugger and several other software tools as well as a unified graphical user interface for working with other Microchip and third-party software and hardware tools. Assembler The free MPLAB IDE tool includes the MPASM assembler. Compiler Microchips MPLAB C18 is a C compiler for PIC18 microcontrollers and is fully integrated for the MPLAB IDE environment. Programmer Microchips MPLAB In-Circuit Debugger (ICD) 2 or PICkit Starter Kit can be used to program the device and both are fully integrated for the MPLAB IDE environment. The free MPLAB IDE tool set and its documentation can be downloaded at http://microchip.com. For a list of the other mentioned devices documentation, see Recommended Reading on page 3. Other assemblers/compilers can be used. For a list of tools compatible with PIC microcontrollers, see the Microchip web site (http://microchip.com).
DS51721B-page 16
Getting Started
2.4.2 Loading the Program
This section describes how to program the PICDEM PIC18 Explorer Demonstration Board using the MPLAB Integrated Development Environment (IDE) and the sample Hex code on the compact disc in the PICDEM PIC18 Explorer Demonstration Boards Kit. 2.4.2.1 REPROGRAMMING WITH THE COMPACT DISC SAMPLE CODE
To program the PIC18F8722: 1. Launch the MPLAB IDE application and select Configure>Select Device>18F8722. 2. To start the programmer, select Programmer>Select Programmer> ICD2. 3. To open the Hex code file, select File>Import>Open and select CD/Hex/18F8722/Demo8722.hex. 4. Connect the J4 jumper to Main (main controller), as shown in Figure 2-7. FIGURE 2-7: J4 JUMPER AND MAIN SETTING Jumper Location Jumper Setting USB
J4
J4 Jumper
Main
5. Move the S4 switch to PIC MCU, as described in Using the Board As Is on page 10. To program the PIC18F87J11 on the PIM: 1. Attach the PIM to the demonstration board. 2. Move the S4 switch to ICE. Note: Both steps 1 and 2 are described in Attaching the PIM on page 13.
3. Launch the MPLAB IDE application and select Configure>Select Device>18F87J11. 4. To start the programmer, select Programmer>Select Programmer>ICD2. 5. To open the Hex code file, select File>Import>Open and select CD/Hex/18F87J11/Demo87J11.hex. 6. Connect the J4 jumper to Main (main controller), as shown in Figure 2-7.
DS51721B-page 17
J4 Jumper
Main
DS51721B-page 18
Getting Started
2.5 CONNECTING TO HOST PC FOR RS-232 COMMUNICATION
As shown in Figure 2-9, there are two ways to connect a PC to the PICDEM PIC18 Explorer Demonstration Board. Via the USB Port Via the DB9 Pin (RS-232 Port) FIGURE 2-9: BOARD TO PC CONNECTION Board Host PC
USB PIC18LF2450 Microcontroller
Tx Rx X1
Tx Rx
2.5.1
To connect the PICDEM PIC18 Explorer Demonstration Board to a host PC via the nine-pin DB9 connector, set jumper J13, as shown in the first illustration in Figure 2-10. This routes the main microcontrollers communications through a transceiver. FIGURE 2-10: JUMPER J13 SETTINGS FOR RS-232 OR USB
Connecting to USB Port
J13
J13
DS51721B-page 19
If the board PC communication is via the USB port, the data will be routed through the PIC18LF2450 mounted on the board, to convert the RS-232 communication to the USB protocol. To connect the PICDEM PIC18 Explorer Demonstration Board to a host PC via the USB port: 1. Set jumper J13, as shown in the second illustration in Figure 2-10. 2. Install the required file on the host PC. (See the following procedure.) If the USB port is used, an *.inf file must be installed on the host PC. To do this: 1. Create a folder named, HPCINF, anywhere on the host PCs hard drive. 2. Using the development kits CD, copy the file, mchpcdc.inf, into that folder. 3. Connect the board to the PC and power up the board. The pop-up window, shown in Figure 2-11, appears. Note: This procedure displays the dialog boxes that appear for the Windows XP operating system. INSTALLING USB *.inf FILE ON PC SCREEN 1
FIGURE 2-11:
4. Select the Install from a list or specific location option and click Next. The screen shown in Figure 2-12 appears.
DS51721B-page 20
Getting Started
FIGURE 2-12: INSTALLING USB *.inf FILE ON PC SCREEN 2
5. Select the check box, Include this location in the search, enter the name of the path (created in Step 1) in the text box below and click Next. The screen shown in Figure 2-13 appears. FIGURE 2-13: INSTALLING USB *.inf FILE ON PC SCREEN 4
DS51721B-page 21
DS51721B-page 22
PICDEM PIC18 EXPLORER DEMONSTRATION BOARD USERS GUIDE Chapter 3. PICDEM PIC18 Explorer Demonstration Board Tutorial Program
The tutorial program is preprogrammed into the PIC18F8722 on the PICDEM PIC18 Explorer Demonstration Board. This program is also on the PICDEM PIC18 Explorer Demonstration Board kits CD-ROM so that it can be reprogrammed on the sample device if it the device had been preprogrammed. For detailed information on the PICDEM PIC18 Explorer Demonstration Board hardware, see Appendix A. Hardware Details.
3.1
1. Voltmeter
This mode uses the Analog-to-Digital Converter (A/D) module to measure the voltage of the R3 potentiometer and display a value between 0.00V and 5.00V on the LCD. (In the case of 3.3V devices, the displayed value will be 0.00V to 3.3V.) The voltage reading is updated continually until the mode is exited by pressing RB0.
2. Temperature
This mode uses an MCP9701A thermal sensor to measure ambient temperature in Celsius and displays it on the LCD. The program also stores the current temperature, when exited, by writing to a defined address on the external, on-board EEPROM. Communication between the microcontroller and sensor is done by the A/D module. To exit this mode, press RB0.
DS51721B-page 23
If using the Hyper Terminal application, use the settings given in Table 3-1. TABLE 3-1: HYPER TERMINAL SETTINGS
Field Bits per second Data bits Parity Stop bits Flow control Setting
To set the clock time: Enter the clock-setting program by pressing RB0. The clock begins running. To set the hours value, press RA5. Increment the hours to the desired value by pressing RB0. To set the minutes value, press RA5. Increment the minutes to the desired value by pressing RB0. To start the clock with the set time, press RA5. The LCD returns to an active clock display. 7. To return to the main menu, press RB0. 1. 2. 3. 4. 5. 6.
DS51721B-page 24
Tutorial Program
FIGURE 3-2: TUTORIAL PROGRAM FLOWCHART
Power-up
Voltmeter RA5 = Next RB0 = Now Volt = n.nnV RB0 = Exit Temperature RA5 = Next RB0 = Now Temperature - 022C RB0 = Exit Clock RA5 = Next RB0 = Now 00.00.02 RA5 = Set, RB0 = Menu
3.2
DS51721B-page 25
DS51721B-page 26
PICDEM PIC18 EXPLORER DEMONSTRATION BOARD USERS GUIDE Appendix A. Hardware Details
A.1 HARDWARE ELEMENTS
A.1.1 Processor Sockets
The PICDEM PIC18 Explorer Demonstration Board can be populated with 64 and 80-pin devices. Using a Plug-In Module (PIM), the board also can support 28, 44, 64 and 80-pin devices. For a list of available PIMs, go to the Microchip web site at http://microchip.com.
A.1.2
Display
Eight LEDs are connected to PORTD of the PICDEM PIC18 Explorer Demonstration Board. The PORTD pins are set high to light the LEDs. These LEDs may be disconnected by removing jumper JP1. One LED (D9) lights to indicate when the board has power.
A.1.3
Power Supply
The PIC18 Explorer Board does not come with a power supply. It can be powered, via J1, with an unregulated DC supply of 9V to 15V. The preferred supply is 9V. For default functionality, a power supply with a current capability of 250 mA is sufficient. Since the board can serve as a modular development platform connecting to multiple expansion boards, voltage regulators (Q1 and Q2) are used. Their maximum current capability is 800 mA. This current capacity may require a power supply of up to 1.6A. Because the regulators do not have heat sinks, long-term operation at such loads is not recommended. When the board is powered, LED D9 is on, indicating the presence of V_VAR. If an external supply is needed, Microchips 9V, 750 mA power supply (part number AC162039) can be used. Note: Do not attempt to power the PICDEM PIC18 Explorer Demonstration Board using the MPLAB ICD 2 module. That module is not designed to be a USB bus power source.
A.1.4
An RS-232, level-shifting integrated circuit has been provided with all the necessary hardware to support the connection of an RS-232 host through the DB9 connector. The port can be connected to a PC using a straight-through cable. The PIC18 receive and transmit pins are tied to the receive and transmit lines of the MAX3232 transceiver through jumper J13. That jumper can direct where the receive and transmit pins of the PIC18 are connected, either to: The PIC18LF2450 which does the RS-232 to USB communication The MAX3232 transceiver Note: For details on this connection, see Section 2.5 Connecting to Host PC for RS-232 Communication.
DS51721B-page 27
Switches
The following switches are available: S1 Active-low switch connected to RB0 S2 Active-low switch connected to RA5 S3 MCLR to hard reset the processor S4 MCLR select switch. If the on board, PIC18F8722 microcontroller is being used, set this to PIC MCU. If an alternate, PIM-mounted microcontroller is being used, set this to ICE.
A.1.6
Oscillator Options
The main oscillator uses a 10 MHz crystal (Y1) which serves as the controllers primary oscillator. A second circuit, using a 32.768-kHz (watch type) crystal (Y2), functions as the Timer1 oscillator, the source for the Real-Time Clock/Calendar (RTCC) and secondary oscillator. The PIC18LF2450, the heart of the RS-232 to USB conversion, is independently clocked with its own 12 MHz crystal (Y3).
A.1.7
A 10 k potentiometer is connected through a series resistor to AN0. To provide an analog input to one of the controllers Analog-to-Digital (A/D) channels, the potentiometer can be adjusted from VDD to GND.
A.1.8
ICD Connector
Microchips low-cost, in-circuit debugger, MPLAB ICD 2, can be connected to the modular connector (J10). The ICD connector utilizes RB6 and RB7 for in-circuit debugging. Note: For details, see Section 2.4.1 Programming Requirements.
A.1.9
PICkit 2 Connector
Microchips low-cost programmer, PICkit 2, can be connected to the 6-pin interface provided by J12. Note: For details, see Section 2.4.1 Programming Requirements.
A.1.10
Temperature Sensor
The analog thermal sensor, MCP9701A (U1), is used for monitoring temperature. The device is connected to the Analog-to-Digital Converter (A/D) module through RA1.
A.1.11
Serial EEPROM
A 25LC256, 256 Kbit (32K x 8) serial EEPROM (U9) is included for nonvolatile storage of firmware. The EEPROM also can demonstrate the operation of the Serial Peripheral Interface (SPI) bus. The EEPROM is enabled or disabled from the SPI bus by jumper JP2.
A.1.12
The PICtail interface enables the PICDEM PIC18 Explorer Demonstration Board to be connected directly to available PICtail daughter board cards. This provides a one-to-one connection between the microcontrollers and the cards through SPI/I2C interfaces.
DS51721B-page 28 2008 Microchip Technology Inc.
Hardware Details
A.1.13 LCD
An LCD display with two lines, 16 characters each, is connected to the SPI I/O expander, MCP23S17. The two control lines and eight data lines are connected to the I/O expander. The I/O expander has an SPI interface that connects it to the microcontroller.The I/O expander is disabled or enabled from the SPI by jumper JP3.
A.1.14
Sample Devices
A sample part programmed with a simple program is included in the PICDEM PIC18 Explorer Demonstration Board Kit. The devices I/O features and port connections are listed in Table A-1.
TABLE A-1:
Device PIC18F8722 PIC18F87J11
RD7:RD0 RC6/RC7 RB0 RA5 MCLR RD7:RD0 RC6/RC7 RB0 RA5 MCLR
DS51721B-page 29
FIGURE A-1:
DS51721B-page 30
EXPLORER
PICDEM PIC18
RD0 V_VAR D2 R6 R40 RE2 RE3 R39 V_VAR 10K RC7 RC7 RC6 RB7 RB6 RB5 RB4 RB4 RB3 RB2 RB1 V_VAR JP1 LCM-SO1602 DTR/M J111 RD1 RA1 R28 1 RA5 1K DB1 DB2 DB3 V_VAR DB5 DB6 DB7 D9 DB0 Power Indicator DB1 DB2 DB3 RA0 R13 V_VAR DB5 R20 15K V_VAR JP3 RA2 TP5 RC5 GND C30 1 .1uF C49 47uF .1uF C39 MCP23S17 RH5 RH7 RH5 RH7 RH1 RH3 RH1 RH3 V_VAR RC3 RF6 RJ1 RJ3 RJ5 RJ7 RJ1 RJ3 RJ5 RJ7 J7 1 3 5 7 9 11 13 15 J6 1 VIN 3 TP4 C29 1 .1uF .1uF C45 47uF ADJ VIN J9 ICEMCLR +5V +3.3V 2 4 6 8 10 12 14 16 RJ0 RJ2 RJ4 RJ6 RH0 RH2 RH4 RH6 RJ0 RJ2 RJ4 RJ6 RH0 RH2 RH4 RH6 DB7 DB6 R16 15K V_VAR 1k DB4 RF7 RE5 RE7 RF7 RE5 RE7 E RS DB4 .1uF DB0 C42 E RB0 2 3 4 MCP9701A RS R29 V_VAR +5V VO 1K RD3 RD5 RD7 RE1 RD1 RD3 RD5 RD7 RE1 3 5 7 9 11 2 4 6 8 10 12 Switch R27 15K S2 RD0 RD2 RD4 RD6 RE0 V_VAR J5 1 RG1 RG3 15 16 LED_+ LED_MDLS-16264 SS-DIF RG1 RG3 PICMCLR RG5 RF1 RF3 RF5 RF1 RF3 RF5 3 5 7 9 11 13 15 17 19 2 4 6 8 10 12 14 16 18 20 RD0 RD2 RD4 RD6 RE0 Temperature Sensor RB0 RB3 RB2 RB1 RB0 11 13 15 17 19 21 23 25 27 RC6 RB7 RB6 RB5 9 +5V VO RS E 25LC256 R38 DB1 DB2 DB3 DB4 DB5 RD7 D8 R12 DB7 1k DB6 1K DB0 RC4 RD4 RC5 RD5 C1 D7 R11 1k .1uF D6 R10 1k D5 R9 V_VAR V_VAR RC3 1k RA6 OSC2 7 RA7 OSC1 5 6 8 10 12 14 16 18 20 22 24 26 28 RE3 3 4 RE2 RD2 D4 R8 RA3 1k JP2 D3 R7 15K 1k +5V 2 J3 1 RA5 RA4 RA3 RC5 RC4 RC3 RA0 RA1 RA2 RC0 RC1 RC2 V_VAR 1k
D1 R5 1k
RD1
RA5 RA4 RA3 RC5 RC4 RC3 RA0 RA1 RA2 RC0 RC1 RC2 PIC tail TM
FIGURE A-2:
80 - 84 pins
64 - 68 pins
40 - 44 pins 8 - 14 - 18 - 20 - 28 pins
RD3
RD6
V_VAR
R14
S1
15K
R15
1K
V_VAR
POT
R4
1K
C24
TBD
Power
S1GB13
C3
220uF ECE-V1EA221UP
VIN
Hardware Details
DS51721B-page 31
V_VAR J2 VDD RE2 RE3 RE4 RE5 RE6 RH1 RH0 RE7 RD0 RD1 RD2 RD3 RD4 RD5 RD6 RD7 RJ0 RJ1 V_VAR RB0 MCLR/RE3 11 81 8 1 80 79 78 77 76 10 6 4 9 7 5 3 2 83 RB2 NC RJ0 RE2 RE3 RE4 RE5 RE6 RH1 RH0 RE7 RD0 VSS RD1 RD2 RD3 RD4 RD5 RD6 22 23 24 RB6 RH3 RB7 RE1 RA5/AN4 RC0 RC1 RC2/CCP1 OSC1 RC4/D-/VM RC5/D+/VP OSC2 22 15 C32 23 .1uF C40 .47uF PIC18LF2450 RC7 RF5 RXD RF4 RF3 RF2 RH7 TXD RC6 RH5 RH4 RF1 RF0 AVDD AVSS RA3 RA2 RA1 RA0 NC VSS VDD RA5 RA4 RC6 RC7 RJ4 RJ5 Y2 RC0 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 52 32Khz C25 RF1 RA3 RA2 RA1 RA0 RA5 RH5 RH4 RA4 RC1 RC0 RC6 V_VAR V_VAR 22pf 22pf RF0 C26 RC7 51 RC1 53 RC1/T1OSI RC0/T1OSO RH6 32 RH6 RJ6 31 RH7 RJ7 54 55 30 RF2 RC2 56 29 RF3 RC3 57 RC3 RC2 V_VAR RJ7 RJ6 C10 .1uF C11 .1uF C12 .1uF C13 .1uF C14 .1uF 28 RF4 RC4 58 RC4 27 RF5 RC5 RC5 59 RF6 26 RF6 RB7 RB7 60 RF7 25 RF7 VDD 61 V_VAR V_VAR 24 VDD OSC1 OSC1 USB_MCLR 62 5 6 VSS OSC2/RA6 OSC2 MCLR 63 NC ICE MODULE NC 64 MAIN_MCLR 1 2 3 RC7/RX VSS VSS RC6/TX 14 4 RG4 21 RG4 VSS 65 J4 13 USB_D+ 3 ICEMCLR 20 RG5/MCLR RB6 RB6 66 12 USB_D2 RG3 19 RG3 RB5 67 RB5 Vusb 11 +3.3V VBUS 1 RG2 18 RG2 RB4 RB4 68 10 J8 RG1 17 RG1 RB3 RB3 69 9 U1A RG0 16 RG0 RB2 RB2 70 8 47K RE0 15 RE0 RB1 71 RB1 R17 14 RE1 RB0 RB0 R22 47K 72 13 RH3 RJ3 RJ3 73 25 RH2 12 RH2 RJ2 RJ2 MAIN_MCLR PICMCLR 74 VDD RD7 RJ1 RA0/AN0 RA1/AN1 RA2/VREFRA3/VREF+ RA4/RCV RB7 RB6 RB5 RB4 ICEMCLR RB3 21 84 82 75 20 V_VAR 3 RB1 19 ADJ 2 18 VIN 1
U5
17
R33
USB_MCLR
26
10K
C31
27
.1uF
VBUS
R37
33K
28
FIGURE A-3:
R19
RJ4
RJ5
OSC1
OSC2
PICMCLR
RE2
RE3
RE4
RE5
RE6
RE7
RD0
V_VAR
RD1
RD2
RD3
RD4
RD5
RD6
57
54
53
52
51
50
64
62
61
60
59
71 48 32 12
70 51 31 11
63
58
56
55
49
RD7
RA0 RJ6 RJ5 RJ4 RJ3 RJ2 RJ1 RJ0 RG1 RH7 RH6 RH5 RH4 RH3 RH2 RH1 RH0 RG4 RG3 RG2 RG1 RG0 RF6 RF5 RF4 RF3 RF2 RF7 V_VAR RG4 PICMCLR 7 8 9 10 11 12 13 14 15 16 RG3 6 RG2 5 RG2 RG3/P3D RG5/MCLR/VPP RG4/P1D VSS VDD RF7/ SS RF6/AN11 RF5/AN10/CVREF RF4/AN9 RF3/AN8 RF2/AN7 RF1/AN6 RF0/AN5 AVDD AVSS PIC18F8527 PIC18F8622 PIC18F8627 PIC18F8722 4 RG1 RG0 3 RE0 2 RE0/RD/P2D RG0/ECCP3/P3A RE1 1 RE1/WR/P2C
AVSS 26 AVDD 25
RJ7
VDD
VSS
RE4/P3B
RE3/P3C
RD0/PSP0
RD1/PSP1
RD2/PSP2
RD3/PSP3
RD4/PSP4
RD5/PSP5
RD6/PSP6
RD7/PSP7
RA2
MCLR/VPP 9
RE5/P1C
RE6/P1B
OSC1/CLKI/RA7 49 OSC2/CLKO/RA6 50
RA4 U4
RE2/CS/P2B
RE7/ECCP2/P2A
4 3 78 77 76 75 74 73
24 23 18 17 16 15 14 13
72 69 68 67 66 65 64 63
RA3/AN3/VREF+
RA2/AN2/VREF-
RA1/AN1
RA0/AN0
VSS
VDD
RA5/AN4/LVDIN
RA4/T0CKI
RC1/T1OSI/ECCP2/P2A
RC0/T1OSO/T13CKI
RC6/TX/CK1
RF1
RF3
RF5
RE0
RE2
RE4
RD0
RD2
RD4
RD6
RE6
RF7
17
24
18
19
20
21
22
23
25
26
27
28
29
30
31
RF0
RF2
RF4
RE1
RE3
RE5
RD1
RD3
RD5
RD7
RE7
RF6
RF1
RF0
RA3
RA2
RA1
RA0
RA5
RA4
RC1
RC0
RC6
V_VAR
V_VAR
RC7
32
RC7/RX/DT1
DS51721B-page 32
V_VAR C22 .1uF C19 .1uF C23 .1uF C20 .1uF C21 .1uF V_VAR ICD Connector V_VAR MCLR RB0/INT0 RB1/INT1 RB2/INT2 U7 RB3/INT3 RB4/KBI0 RB5/KBI1/PGM RB6/KBI2/PGC PIC18F6527 PIC18F6622 PIC18F6627 PIC18F6522 VSS RA6/OSC2/CLKO RA7/OSC1/CLKI VDD RB7/KBI3/PGD RC5/SDO1 RC4/SDI1/SDA1 RC3/SCK1/SCL1 RC2/ECCP1/P1A 48 47 46 45 44 43 42 41 1 40 39 38 37 36 35 34 33 OSC2 OSC1 V_VAR RB7 RC5 RC4 RC3 RC2 PICKIT2 Programmer C18 .1uF RB7 RB6 4 5 6 2 4 3 R23 1k MAIN_MCLR MCLR V_VAR 1 2 3 RB0 RB1 RB2 RB3 RB4 RB5 RB6 S3 J12 R18 4.7K V_VAR C17 .1uF RB7 RB6 R24 100 1 2 3 4 5 6 J10
RJ7/UB RJ6/LB RJ5/CE RJ4/BA0 RJ3/WRH RJ2/WRL RJ1/OE RJ0/ALE 42 41 40 39 59 60 61 62 RH7/AN15 RH6/AN14 RH5/AN13 RH4/AN12 RH3/A19 RH2/A18 RH1/A17 RH0/A16 19 20 21 22 2 1 80 79 RG4/CCP5 10 RG3/CCP4 8 RG2/RX2/DT2 7 RG1/TX2/CK2 6 RG0/CCP3 5
47K
R34
1M
Y3
C2
12Mhz
16
C33
22pf
22pf
R21
1M
Y1
OSC1
OSC2
C15
10Mhz
C16
22pf
22pf
RA1
RA3
RA5
30 29 28 27 34 33
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
58 57 56 55 54 53 52 47
RC0
RC1
RC2
RC3
RC4
RC5
RC6
RC7
36 35 43 44 45 46 37 38
Hardware Details
NOTES:
DS51721B-page 33
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-8528-2100 Fax: 86-10-8528-2104 China - Chengdu Tel: 86-28-8665-5511 Fax: 86-28-8665-7889 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 - Xiamen Tel: 86-592-2388138 Fax: 86-592-2388130 China - Xian Tel: 86-29-8833-7252 Fax: 86-29-8833-7256 China - Zhuhai Tel: 86-756-3210040 Fax: 86-756-3210049
ASIA/PACIFIC
India - Bangalore Tel: 91-80-4182-8400 Fax: 91-80-4182-8422 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-572-9526 Fax: 886-3-572-6459 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 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
01/02/08
DS51721B-page 34