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.
6.0Flash Program Memory.............................................................................................................................................................. 97
7.0External Memory Bus ............................................................................................................................................................... 107
8.08 x 8 Hardware Multiplier.......................................................................................................................................................... 119
19.0 Master Synchronous Serial Port (MSSP) Module .................................................................................................................... 257
23.0 Comparator Voltage Reference Module ................................................................................................................................... 343
24.0 Special Features of the CPU.................................................................................................................................................... 347
25.0 Instruction Set Summary.......................................................................................................................................................... 361
26.0 Development Support............................................................................................................................................................... 411
Index .................................................................................................................................................................................................. 463
The Microchip Web Site..................................................................................................................................................................... 475
Customer Change Notification Service .............................................................................................................................................. 475
Customer Support .............................................................................................................................................................................. 475
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at docerrors@microchip.com or fax the Reader Response Form in the back of this data sheet to (480) 792-4150. We
welcome your feedback.
Most Current Data Sheet
To obtain the most up-to-date version of this data sheet, please register at our Worldwide Web site at:
http://www.microchip.com
You can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page.
The last character of the literature number is the version number, (e.g., DS30000A is version A of document DS30000).
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide Web site; http://www.microchip.com
• Your local Microchip sales office (see last page)
When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you are
using.
Customer Notification System
Register on our web site at www.microchip.com to receive the most current information on all of our products.
This document contains device-specific information for
the following devices:
• PIC18F66J60• PIC18F87J60
• PIC18F66J65• PIC18F96J60
• PIC18F67J60• PIC18F96J65
• PIC18F86J60• PIC18F97J60
• PIC18F86J65
This family introduces a new line of low-voltage devices
with the foremost traditional advantage of all PIC18
microcontrollers – namely, high computational performance and a rich feature set at an extremely
competitive price point. These features make the
PIC18F97J60 family a logical choice for many
high-performance applications where cost is a primary
consideration.
1.1Core Features
1.1.1OSCILLATOR OPTIONS AND
FEATURES
All of the devices in the PIC18F97J60 family offer five
different oscillator options, allowing users a range of
choices in developing application hardware. These
options include:
• Two Crystal modes, using crystals or ceramic
resonators.
• Two External Clock modes, offering the option of
a divide-by-4 clock output.
• A Phase Lock Loop (PLL) frequency multiplier,
available to the external oscillator modes, which
allows clock speeds of up to 41.667 MHz.
• An internal RC oscillator with a fixed 31 kHz
output which provides an extremely low-power
option for timing-insensitive applications.
The internal oscillator block provides a stable reference
source that gives the family additional features for
robust operation:
• Fail-Safe Clock Monitor: This option constantly
monitors the main clock source against a reference
signal provided by the internal oscillator. If a clock
failure occurs, the controller is switched to the
internal oscillator, allowing for continued low-speed
operation or a safe application shutdown.
• Two-Speed Start-up: This option allows the
internal oscillator to serve as the clock source
from Power-on Reset, or wake-up from Sleep
mode, until the primary clock source is available.
1.1.2EXPANDED MEMORY
The PIC18F97J60 family provides ample room for
application code, from 64 Kbytes to 128 Kbytes of code
space. The Flash cells for program memory are rated
to last 100 erase/write cycles. Data retention without
refresh is conservatively estimated to be greater than
20 years.
The PIC18F97J60 family also provides plenty of room
for dynamic application data with 3808 bytes of data
RAM.
1.1.3EXTERNAL MEMORY BUS
In the unlikely event that 128 Kbytes of memory are
inadequate for an application, the 100-pin members of
the PIC18F97J60 family also implement an External
Memory Bus (EMB). This allows the controller’s internal program counter to address a memory space of up
to 2 Mbytes, permitting a level of data access that few
8-bit devices can claim. This allows additional memory
options, including:
• Using combinations of on-chip and external
memory up to the 2-Mbyte limit
• Using external Flash memory for reprogrammable
application code or large data tables
• Using external RAM devices for storing large
amounts of variable data
1.1.4EXTENDED INSTRUCTION SET
The PIC18F97J60 family implements the optional
extension to the PIC18 instruction set, adding eight
new instructions and an Indexed Addressing mode.
Enabled as a device configuration option, the extension
has been specifically designed to optimize reentrant
application code originally developed in high-level
languages, such as C.
1.1.5EASY MIGRATION
Regardless of the memory size, all devices share the
same rich set of peripherals, allowing for a smooth
migration path as applications grow and evolve.
• Communications: The PIC18F97J60 family
incorporates a range of serial communication
peripherals, including up to two independent
Enhanced USARTs and up to two Master SSP
modules, capable of both SPI and I
and Slave) modes of operation. In addition, one of
the general purpose I/O ports can be reconfigured
as an 8-bit Parallel Slave Port for direct
processor-to-processor communications.
• CCP Modules: All devices in the family incorporate
two Capture/Compare/PWM (CCP) modules and
three Enhanced CCP (ECCP) modules to maximize
flexibility in control applications. Up to four different
time bases may be used to perform several
different operations at once. Each of the three
ECCP modules offers up to four PWM outputs,
allowing for a total of twelve PWMs. The ECCP
modules also offer many beneficial features,
including polarity selection, programmable dead
time, auto-shutdown and restart and Half-Bridge
and Full-Bridge Output modes.
• 10-Bit A/D Converter: This module incorporates
programmable acquisition time, allowing for a
channel to be selected and a conversion to be
initiated without waiting for a sampling period and
thus, reducing code overhead.
• Extended Watchdog Timer (WDT): This
enhanced version incorporates a 16-bit prescaler,
allowing an extended time-out range. See
Section 27.0 “Electrical Characteristics” for
time-out periods.
2
C™ (Master
1.3Details on Individual Family
Members
Devices in the PIC18F97J60 family are available in
64-pin, 80-pin and 100-pin packages. Block diagrams
for the three groups are shown in Figure 1-1,
Figure 1-2 and Figure 1-3.
The devices are differentiated from each other in four
ways:
1.Flash program memory (three sizes, ranging
from 64 Kbytes for PIC18FX6J60 devices to
128 Kbytes for PIC18FX7J60 devices).
2.A/D channels (eleven for 64-pin devices, fifteen
for 80-pin pin devices and sixteen for 100-pin
devices).
3.Serial communication modules (one EUSART
module and one MSSP module on 64-pin
devices, two EUSART modules and one MSSP
module on 80-pin devices and two EUSART
modules and two MSSP modules on 100-pin
devices).
4.I/O pins (39 on 64-pin devices, 55 on 80-pin
devices and 70 on 100-pin devices).
All other features for devices in this family are identical.
These are summarized in Table 1-1, Table 1-2 and
Table 1-3.
The pinouts for all devices are listed in Table 1-4,
Table 1-5 and Table 1-6.
ST= Schmitt Trigger input with CMOS levels Analog= Analog input
I= Input O= Output
P= Power OD= Open-Drain (no P diode to V
7ISTMaster Clear (Reset) input. This pin is an active-low Reset
to the device.
39
40
24
23
22
21
28
27
O
O
I/O
O
I/O
O
I/O
I/O
I/O
I/O
I
I
CMOS
I
Analog
I
Analog
I
Analog
I
Analog
I
Analog
I
Analog
I
I
Analog
Oscillator crystal or external clock input.
ST
—
—
TTL
—
TTL
—
TTL
TTL
ST
ST
TTL
Oscillator crystal input or external clock source input.
ST buffer when configured in internal RC mode; CMOS
otherwise.
External clock source input. Always associated
with pin function OSC1. (See related OSC2/CLKO pin.)
Oscillator crystal or clock output.
Oscillator crystal output. Connects to crystal or
resonator in Crystal Oscillator mode.
In Internal RC mode, OSC2 pin outputs CLKO which has
1/4 the frequency of OSC1 and denotes the
instruction cycle rate.
PORTA is a bidirectional I/O port.
Digital I/O.
Ethernet LEDA indicator output.
Analog input 0.
Digital I/O.
Ethernet LEDB indicator output.
Analog input 1.
Digital I/O.
Analog input 2.
A/D reference voltage (low) input.
Digital I/O.
Analog input 3.
A/D reference voltage (high) input.
Note 1:Default assignment for ECCP2/P2A when CCP2MX Configuration bit is set.
REF-
RA2
AN2
REF-
V
REF+
RA3
AN3
REF+
V
RA4
T0CKI
RA5
AN4
ST= Schmitt Trigger input with CMOS levels Analog= Analog input
I= Input O= Output
P= Power OD= Open-Drain (no P diode to V
2:Default assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is set).
3:Alternate assignment for ECCP2/P2A when CCP2MX Configuration bit is cleared.
4:Alternate assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is cleared).
9ISTMaster Clear (Reset) input. This pin is an active-low Reset to
the device.
49
50
30
29
28
27
34
33
O
O
I/O
O
I/O
O
I/O
I/O
I/O
I/O
I
I
CMOS
I
Analog
I
Analog
I
Analog
I
Analog
I
Analog
I
Analog
I
I
Analog
Oscillator crystal or external clock input.
ST
—
—
TTL
—
TTL
—
TTL
TTL
ST
ST
TTL
Oscillator crystal input or external clock source input.
ST buffer when configured in internal RC mode; CMOS
otherwise.
External clock source input. Always associated with
pin function OSC1. (See related OSC2/CLKO pin.)
Oscillator crystal or clock output.
Oscillator crystal output. Connects to crystal or
resonator in Crystal Oscillator mode.
In Internal RC mode, OSC2 pin outputs CLKO which has
1/4 the frequency of OSC1 and denotes the
instruction cycle rate.
PORTA is a bidirectional I/O port.
Digital I/O.
Ethernet LEDA indicator output.
Analog input 0.
Digital I/O.
Ethernet LEDB indicator output.
Analog input 1.
Digital I/O.
Analog input 2.
A/D reference voltage (low) input.
Digital I/O.
Analog input 3.
A/D reference voltage (high) input.
ST= Schmitt Trigger input with CMOS levels Analog= Analog input
I= Input O= Output
P= Power OD= Open-Drain (no P diode to V
Note 1:Default assignment for ECCP2/P2A when CCP2MX Configuration bit is set.
2:Default assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is set).
3:Alternate assignment for ECCP2/P2A when CCP2MX Configuration bit is cleared.
4:Alternate assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is cleared).
Pin Number
TQFP
5
6
7
8
54
53
52
47
Pin
Typ e
I/O
I
I
I/O
I
I/O
I
I/O
I
I/O
I
I/O
I
I/O
I
I/O
I/O
I
I/O
Buffer
Type
TTL
ST
ST
TTL
ST
TTL
ST
TTL
ST
TTL
TTL
TTL
TTL
TTL
TTL
ST
TTL
TTL
ST
Description
PORTB is a bidirectional I/O port. PORTB can be software
programmed for internal weak pull-ups on all inputs.
Digital I/O.
External interrupt 0.
Enhanced PWM Fault input (ECCP modules); enabled
in software.
Digital I/O.
External interrupt 1.
Digital I/O.
External interrupt 2.
Digital I/O.
External interrupt 3.
Digital I/O.
Interrupt-on-change pin.
Digital I/O.
Interrupt-on-change pin.
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP™ programming clock pin.
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming data pin.
ST= Schmitt Trigger input with CMOS levels Analog= Analog input
I= Input O= Output
P= Power OD= Open-Drain (no P diode to V
Note 1:Default assignment for ECCP2/P2A when CCP2MX Configuration bit is set.
2:Default assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is set).
3:Alternate assignment for ECCP2/P2A when CCP2MX Configuration bit is cleared.
4:Alternate assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is cleared).
Pin Number
TQFP
36
35
43
44
45
46
37
38
Pin
Typ e
I/O
O
I
I/O
I
I/O
O
I/O
I/O
O
I/O
I/O
I/O
I/O
I
I/O
I/O
O
I/O
O
I/O
I/O
I
I/O
Buffer
Type
ST
—
ST
ST
CMOS
ST
—
ST
ST
—
ST
ST
ST
ST
ST
ST
ST
—
ST
—
ST
ST
ST
ST
Description
PORTC is a bidirectional I/O port.
Digital I/O.
Timer1 oscillator output.
Timer1/Timer3 external clock input.
Digital I/O.
Timer1 oscillator input.
Capture 2 input/Compare 2 output/PWM2 output.
ECCP2 PWM output A.
Digital I/O.
Capture 1 input/Compare 1 output/PWM1 output.
ECCP1 PWM output A.
Digital I/O.
Synchronous serial clock input/output for SPI mode.
Synchronous serial clock input/output for I
Digital I/O.
SPI data in.
I2C data I/O.
Digital I/O.
SPI data out.
Digital I/O.
EUSART1 asynchronous transmit.
EUSART1 synchronous clock (see related RX1/DT1 pin).
Digital I/O.
EUSART1 asynchronous receive.
EUSART1 synchronous data (see related TX1/CK1 pin).
ST= Schmitt Trigger input with CMOS levels Analog= Analog input
I= Input O= Output
P= Power OD= Open-Drain (no P diode to V
Note 1:Default assignment for ECCP2/P2A when CCP2MX Configuration bit is set.
2:Default assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is set).
3:Alternate assignment for ECCP2/P2A when CCP2MX Configuration bit is cleared.
4:Alternate assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is cleared).
Pin Number
TQFP
4
3
78
77
76
75
74
73
Pin
Typ e
I/O
O
I/O
O
I/O
O
I/O
O
I/O
O
I/O
O
I/O
O
I/O
I/O
O
Buffer
Type
ST
—
ST
—
ST
—
ST
—
ST
—
ST
—
ST
—
ST
ST
—
Description
PORTD is a bidirectional I/O port.
PORTE is a bidirectional I/O port.
Digital I/O.
ECCP2 PWM output D.
Digital I/O.
ECCP2 PWM output C.
Digital I/O.
ECCP2 PWM output B.
Digital I/O.
ECCP3 PWM output C.
Digital I/O.
ECCP3 PWM output B.
Digital I/O.
ECCP1 PWM output C.
Digital I/O.
ECCP1 PWM output B.
Digital I/O.
Capture 2 input/Compare 2 output/PWM2 output.
ECCP2 PWM output A.
Note 1:Default assignment for ECCP2/P2A when CCP2MX Configuration bit is set.
REF
ST= Schmitt Trigger input with CMOS levels Analog= Analog input
I= Input O= Output
P= Power OD= Open-Drain (no P diode to VDD)
2:Default assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is set).
3:Alternate assignment for ECCP2/P2A when CCP2MX Configuration bit is cleared.
4:Alternate assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is cleared).
Pin Number
TQFP
23
18
17
16
15
14
13
Pin
Typ e
I/O
I
O
I/O
I
O
I/O
I
I/O
I
I/O
I
O
I/O
I
I/O
I
Buffer
Type
ST
Analog
—
ST
Analog
—
ST
Analog
ST
Analog
ST
Analog
—
ST
Analog
ST
TTL
Description
PORTF is a bidirectional I/O port.
Digital I/O.
Analog input 6.
Comparator 2 output.
Digital I/O.
Analog input 7.
Comparator 1 output.
Digital I/O.
Analog input 8.
Digital I/O.
Analog input 9.
Digital I/O.
Analog input 10.
Comparator reference voltage output.
ST= Schmitt Trigger input with CMOS levels Analog= Analog input
I= Input O= Output
P= Power OD= Open-Drain (no P diode to V
Note 1:Default assignment for ECCP2/P2A when CCP2MX Configuration bit is set.
2:Default assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is set).
3:Alternate assignment for ECCP2/P2A when CCP2MX Configuration bit is cleared.
4:Alternate assignments for P1B/P1C/P3B/P3C (ECCPMX Configuration bit is cleared).
Pin Number
TQFP
56
55
42
41
10
Pin
Typ e
I/O
I/O
O
I/O
O
I/O
I/O
I
I/O
I/O
I/O
O
I/O
I/O
O
Buffer
Type
ST
ST
—
ST
—
ST
ST
ST
ST
ST
ST
—
ST
ST
—
Description
PORTG is a bidirectional I/O port.
Digital I/O.
Capture 3 input/Compare 3 output/PWM3 output.
ECCP3 PWM output A.
Digital I/O.
EUSART2 asynchronous transmit.
EUSART2 synchronous clock (see related RX2/DT2 pin).
Digital I/O.
EUSART2 asynchronous receive.
EUSART2 synchronous data (see related TX2/CK2 pin).
Digital I/O.
Capture 4 input/Compare 4 output/PWM4 output.
ECCP3 PWM output D.
Digital I/O.
Capture 5 input/Compare 5 output/PWM5 output.
ECCP1 PWM output D.