Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Plug-In Module
User’s Guide
• 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.
Table of Contents
Preface ........................................................................................................................... 1
Chapter 1. Introduction and Overview ......................................................................... 5
1.1 Introduction ..................................................................................................... 5
1.2 Highlights ........................................................................................................ 5
1.3 PIC18F87J50 FS USB Plug-In Module Kit Contents ...................................... 5
1.4 Overview of the PIC18F87J50 Family USB Capabilities ................................ 6
1.5 Using the Preprogrammed Firmware ............................................................. 6
Chapter 2. Important Notes and Migration Tips .......................................................... 7
2.1 Highlights ........................................................................................................ 7
2.2 Using the PIM with the HPC Explorer Board .................................................. 7
2.3 Programming the Microcontroller ................................................................... 8
2.4 Migrating to the PIC18F87J50 Family ............................................................ 8
Chapter 3. Hardware Configuration/Jumper Settings .............................................. 11
3.1 Highlights .......................................................................................................11
3.2 Hardware Features ........................................................................................11
3.3 Crystal .......................................................................................................... 12
3.4 Linear Regulator/Power Management .......................................................... 13
3.5 LEDs ............................................................................................................. 14
3.6 Push Buttons ................................................................................................ 14
3.7 Jumpers ........................................................................................................ 14
3.8 Hardware Considerations for Compliance Testing ....................................... 15
Chapter 4. Demo Code/Reference Firmware ............................................................. 17
Appendix A. PIC18F87J50 FS USB Plug-In Module Schematics ............................. 19
A.1 Schematics .................................................................................................. 19
Index ............................................................................................................................. 23
Worldwide Sales and Service .................................................................................... 24
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® IDE on-line help.
Select the Help menu, and then Topics to open a list of available on-line help files.
INTRODUCTION
This chapter contains general information that will be useful to know before using the
PIC18F87J50 FS USB Plug-In Module. 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 PIC18F87J50 FS USB Plug-In Module. The
manual layout is as follows:
• Chapter 1. “Introduction and Overview”
• Chapter 2. “Important Notes and Migration Tips”
• Chapter 3. “Hardware Configuration/Jumper Settings”
• Chapter 4. “Demo Code/Reference Firmware”
• Appendix A. “PIC18F87J50 FS USB Plug-In Module Schematics”
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 “Save project before build”
dialog
Underlined, italic text with A menu path File>Save
right angle bracket
Bold characters A dialog button Click OK
A tab Click the Power tab
N‘Rnnnn A number in verilog format, 4‘b0010, 2‘hF1
where N is the total number of
digits, R is the radix and n is a
digit.
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:\mcc18\h
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 Choice of mutually exclusive errorlevel {0|1}
character: { | } arguments; an OR selection
Ellipses... Replaces repeated text var_name [,
var_name...]
Represents code supplied by void main (void)
user { ...
}
RECOMMENDED READING
This user's guide describes how to use PIC18F87J50 FS USB Plug-In Module. Other
useful documents are listed below. The following Microchip documents are available
and recommended as supplemental reference resources.
PIC18F87J50 Family Data Sheet (DS39775)
MCHPFSUSB Firmware User’s Guide (DS51679)
PICDEM™ FS USB Demonstration Board User’s Guide (DS51526)
USB related application notes, firmware and other resources will be posted at the
Microchip full-speed USB design center:
http://www.microchip.com/usb/ (click on the “Full-Speed USB Solutions” link)
Schematics and other support materials for the HPC Explorer board can be obtained at:
http://www.microchip.com/HPCExplorer
In addition to Microchip documents, the official USB 2.0 specifications are of particular
interest. These can be obtained from the USB Implementer’s Forum:
http://www.usb.org
Chapter 9 of the official USB 2.0 specifications is especially important, as it strongly
influences the development of USB firmware.
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
1.2 HIGHLIGHTS
Items discussed in this chapter include:
• PIC18F87J50 FS USB Plug-In Module Kit Contents
• Overview of the PIC18F87J50 Family USB Capabilities
• Using the Preprogrammed Firmware
3 9
5
JP
JP1
8
JP
4
7 4 6
3.3 CRYSTAL
In order to use the USB module on the PIC18F87J50 family of microcontrollers, the
module requires a fixed 48 MHz or 6 MHz clock for use in Full-Speed or Low-Speed
modes, respectively. These clock frequencies can be derived from the internal 96 MHz
PLL, and the microcontroller core need not run at the same frequency as the USB
module. In order to use the 96 MHz PLL, a clock source which is an integer multiple of
4 MHz is required. A 12 MHz crystal is included on the board for this purpose.
On the PIC18F87J50 microcontroller, the oscillator pins (RA6 and RA7) route directly
to the 12 MHz crystal. Unlike most other I/O pins, these do not route directly to the “ICE
Module” female headers. Two resistor pads can be used to connect RA6 and RA7 to
the female header pins, but by default, these are left unpopulated. This is done to
prevent “crystal contention” between the 12 MHz crystal on the PIM and the 10 MHz
crystal on the HPC Explorer board.
3.5 LEDs
Two high-efficiency, red LEDs have been included on the PIM. The LEDs are
connected to I/O pins, RE0 and RE1, and may be used for general purpose indication.
The LEDs are connected such that they turn on when the I/O pin controlling them is
driven high. Alternatively, if the I/O pin loading is undesirable (each LED consumes
approximately 1 mA when turned on), jumper cap covering, JP5, may be removed. This
will effectively disconnect both LEDs from their respective I/O pins.
3.7 JUMPERS
The PIM has three jumper headers on it to provide additional flexibility for
experimentation and development purposes.
JP1 – This is a three-pin header with the labels, ‘I’, ‘R’ and ‘U’. The ‘R’ is an abbreviation
referring to microcontroller pin, RB5. ‘I’ is an abbreviation referring to the “ICE” female
header pin for the RB5 signal. ‘U’ is an abbreviation for the USB VBUS line.
When the jumper is in the ‘R’ to ‘I’ position, the RB5 pin connects only to the ICE female
header pin, just like most of the other general purpose I/O pins. When the jumper is in
the ‘R’ to ‘U’ position, RB5 (which is 5.5V tolerant) can be used to sense when the USB
cable has been attached to the host, and when the host is actively providing power to
the +5V VBUS line. According to the USB 2.0 specifications, no device should ever pull
the D+ or D- lines high (such as with the D+ or D- pull-up resistor) until the host actively
powers the +5V VBUS line. This is intended to prevent self-powered peripherals from
ever sourcing even small amounts of power to the host when the host is not powered.
Small amounts of current could potentially prevent the host (and possibly other USB
peripherals connected to that host) from fully becoming depowered, which may cause
problems during power-up and initialization.
Self-powered peripherals should periodically monitor the +5V VBUS line and detect
when it is driven high. Only when it is powered should user firmware enable the USB
module and turn on the D+ (for full speed) or D- (for low speed) pull-up resistor, signal-
ing device attach to the host. The recommended method of monitoring the +5V VBUS
line is to connect it to one of the microcontroller’s 5.5V tolerant I/O pins through a large
value resistor (such as 100 kOhms). The resistor serves to improve the ESD rugged-
ness of the circuit as well as to prevent microcontroller damage if user firmware should
ever unintentionally configure the I/O pin as an output.
Peripherals which are purely bus powered obtain all of their power directly from the +5V
VBUS line itself. For these types of devices, it is unnecessary to monitor when the VBUS
is powered, as the peripheral will not be able to source current on the D+, D- or VBUS
lines when the host is not powered.
JP4 – This jumper is located in series with the +5V VBUS power supply line from the
USB connector. When the jumper is removed, a current meter may be placed between
the header pins to measure the board current which is being drawn from the USB port.
Additionally, by removing the jumper cap altogether, JP4 provides a means of prevent-
ing the board from consuming USB power. See Section 3.4 “Linear Regulator/Power
Management” for more details.
JP5 – This jumper provides a means of removing the LED pin loading on the RE0 and
RE1 pins.
A.1 SCHEMATICS
The PIC18F87J50 FS USB Plug-In Module schematics are shown in Figure A-1 and
Figure A-2. By default, the PIM ships from the factory with the PIC18F87J50
pre-installed in location U1. The PIC18F87J50 is the superset part in the device family,
and is therefore, a good starting point for developing USB applications that will
eventually use one of the other devices in the device family.
However, the pads of U1 have been designed to accommodate any of the products in
the PIC18F87J50 family of microcontrollers, both the 80-pin TQFP and 64-pin TQFP.
For example, if the PIC18F87J50 is carefully desoldered using hot air, and the pads are
cleaned using solder wick, it is possible to install the 64-pin TQFP PIC18F65J50 in its
place. This is possible since the pin pitch is the same between the 64-pin and 80-pin
TQFP packages, and the functionality is the same for pins which share the same loca-
tions between the two packages. Effectively, the 80-pin TQFP pads of U1 overlap with
the standard 64-pin TQFP pads.
The board revision number can be found etched into the copper on the bottom side of
the PCB underneath the programming header. The board revision number is the last
number in the line and is located inside the rectangular box.
2.2 MF
TM
1 MF
1 MF
.1 MF
VBUS
VBUS
VDDCORE
4.7 MF .1 MF
VSS
VDD
18 pF 18 pF
71
48
32
12
70
51
31
11
VSS
VSS
VSS
VSS
VDD
VDD
VDD
AVSS 26
MCLR 9
AVDD 25
30 RA0/AN0 RJ7/UB
29 42
RA1/AN1 RJ6/LB 41 VSS
28 RA2/AN2/VREF- RJ5/CE
27 40
RA3/AN3/VREF+ RJ4/BA0 39
34
OSC1/CLKI/RA7 49
RA4/T0CKI RJ3/WRH
OSC2/CLKO/RA6 50
VDDCORE/VCAP
33 59
RA5/AN4 RJ2/WRL 60 VSS
RJ1/OE 61
RJ0/ALE 62 VDD
58 RB0/INT0
57 RB1/INT1
56 VDD
RB2/INT2 RH7/AN15 19
55 RB3/INT3/CCP2 RH6/AN14 VDDCORE/VCAP
54 20 VUSB
RB4/KBI0/PMA1 RH5/AN13 21
53 RB5/KBI1/PMA0 RH4/AN12 VDD AVDD
52 22
RB6/KBI2PGC RH3/A19 2
47 RB7/KBI3/PGD RH2/A18 1
PIC18F87J50 RH1/A17 80
RH0/A16 79
36 RC0/T1OSO/T13CKI
35 RC1/T1OSI/CCP2
43 RC2/CCP1 RG4/CCP5
44 10
RC3/SCK1/SCL1 RG3/CCP4 8
45 RC4/SDI1/SDA1 RG2/RX2/DT2
46 7
RC5/SDO1 RG1/TX2/CK2 6
37 RC6/TX1/CK1 RG0/ECCP3
38 5
RC7/RX1/DT1
AVDD
AVSS
VSS
VDD
RD0/AD0
RD1/AD1
RD2/AD2
RD3/AD3
RD4/AD4/SDO2
RD5/AD5/SDA2
RD6/AD6/SCK2/SCL2
RD7/AD7/SS2
RE0/AD8
RE1/AD9
RE2/AD10
RE3/AD11
RE4/AD12
RE5/AD13
RE6/AD14
RE7/AD15
ENVREG
VUSB
RF2/AN7
RF3/D-
RF4/D+
RF5/AN10/CVREF
RF6/AN11
RF7/SS
4
3
72
69
68
67
66
65
64
63
78
77
76
75
74
73
24
23
18
17
16
15
14
13
VUSB
VUSB
PIC18F87J50 FS USB PIM REV. 1 SCHEMATICS (SHEET 2 OF 2)
.1 MF
VUSB
DS51678A-page 21
PIC18F87J50 FS USB Plug-In Module Schematics
PIC18F87J50 FS USB Plug-In Module User’s Guide
NOTES:
Index
C L
Crystal ...................................................................... 12 LEDs ........................................................................ 14
Customer Notification Service.................................... 4 Linear Regulator....................................................... 13
Customer Support ...................................................... 4
M
D Microchip Internet Web Site ....................................... 3
Demo Code/Reference Firmware ............................ 17 Migrating to the PIC18F87J50 Family........................ 8
Documentation
O
Conventions ........................................................ 2
Layout ................................................................. 1 Oscillator Configuration.............................................. 9
Overview of PIC18F87J50 USB Capabilities ............. 6
H
P
Hardware
Features............................................................ 11 Power Management ................................................. 13
Hardware Considerations for Programming the MCU .............................................. 8
Compliance Testing.............................................. 15 Push Buttons............................................................ 14
HPC Explorer Board R
Use with the PIM................................................. 7
Reading, Recommended ........................................... 3
I
S
Input Buffer Selection................................................. 9
Schematics............................................................... 19
Internet Address......................................................... 3
Special Function Register Addressing ....................... 8
J
U
Jumpers ................................................................... 14
Using the Preprogrammed Firmware ......................... 6
JP1.................................................................... 14
JP4.................................................................... 15 W
JP5.................................................................... 15 WWW Address........................................................... 3
K
Kit Contents ............................................................... 5
CD-ROM ............................................................. 5
PIC18F87J50 FS USB Plug-In Module
Demo Board ......................................... 5
USB mini-B Cable ............................................... 5
06/25/07