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 intended through suggestion only
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
No representation or warranty is given and no liability is
assumed by Microchip Technology Incorporated with respect
to the accuracy or use of such information, or infringement of
patents or other intellectual property rights arising from such
use or otherwise. Use of Microchip’s products 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 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, 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, Migratable Memory, MPASM,
MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net,
PICLAB, PICtail, PowerCal, PowerInfo, PowerMate,
PowerTool, rfLAB, rfPICDEM, Select Mode, Smart Serial,
SmartTel and Total Endurance 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 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
DS39629B-page iiPreliminary 2004 Microchip Technology Inc.
PIC18F6390/6490/8390/8490
64/80-Pin Flash Microcontrol lers with LCD Driver
and nanoW att Technology
LCD Driver Module Features:
• Direct driving of LCD panel
• Up to 48 segm ents: Software Selectable
• Programmable LCD timing module:
- Multiple LCD timing sources available
- Up to 4 commons: Static, 1/2, 1/3 or 1/4 mu ltiplex
- Static, 1/2 or 1/3 bias configuration
• Can drive LCD panel while in Sleep mode
Power Managed Modes:
• Run: CPU on, peripheral s on
• Idle: CPU off, peripheral s on
• Sleep: CPU off, peripherals off
• Idle mode currents down to 5.8 µA typical
• Sleep current down to 0.1 µA typical
• Timer1 Oscillator: 1.8 µA, 32 kHz, 2V
• Watchdog Timer: 2.1 µA
• T wo -Spe ed Os ci ll ator Start-up
Flexible Oscillator Struc ture:
• Four Crystal modes:
- LP: up to 200 kHz
- XT: up to 4 MHz
- HS: up to 40 MHz
- HSPLL: 4-10 MHz (16-40 MHz internal)
• 4x Phase Lock Loop (available for crystal and
internal oscillators)
• Two External RC modes, up to 4 MHz
• Two External Clock modes, up to 40 MHz
• Internal oscillator block:
- 8 user selectable frequencies, from 31 kHz to 8 MHz
- Provides a complete range of clock speeds
from 31 kHz to 32 MHz when used with PLL
- User-tunable to compensate for frequency drift
• Secondary oscillator using Timer1 @ 32 kHz
• Fail-Safe Clock Monitor:
- Allows for safe sh ut down of dev ice if prim ary
or secondary clock fails
Peripheral Highlight s:
• High current sink/source 25 mA/25 mA
• Four external interrupts
• Four input-change interrupts
• Four 8-bit/16-bit Timer/Counter modules
• Real-Time Clock (RTC) Software module:
- Configurable 24-hour clock, calendar , auto matic
100-year or 12800-year, day-of-w eek calculator
- Uses Timer1
• Up to 2 Capture/Compare/PWM (CCP) modules
• Master Synchronous Serial Port (MSSP) module
supporting 3-wire SPI™ (all 4 modes) and I
2
C™
Master and Slave modes
• Addressable USART module:
- Supports RS-485 and RS-232
• Enhanced Addressable USART module:
- Supports RS-485, RS-232 and LIN 1.2
- Auto-wake-up on Start bit
- Auto-baud Detect
• 10-bit, up to 12-channel Analog-to-Digital
Converter module (A/D):
- Auto-acquisition capability
- Conversion available during Sleep
• Dual analog comparators with input multiplexing
Special Microcontroller Features:
• C compiler optimized architecture
- Optional extended instruct ion set designed to
optimize re-entrant code
• 1000 erase/wr i te cy c le Fl as h pr ogram memory typical
• Flash Retention: 100 years typical
• Priority levels for interrupts
• 8 x 8 Single-Cycle Hardware Multiplier
• Extended Watchdog Timer (WDT):
- Programmable period from 4 ms to 132 s
- 2% stability over V
• In-Circuit Serial Programming ™ (ICSP™) via two pins
6.0Flash Progr a m Mem o ry............. ................. ................. ................................................ ...............................................................87
7.08 x 8 Hardware Multiplier...................................................................... ...................................................................................... 91
15.0 Master Synchronous Serial Port (MSSP) Module .................................................................................................................... 157
23.0 Special Features of the CPU.............. ................ ................. ................. ................. ............... .................................................... 281
24.0 Instruction Set Summary.......................................................................................................................................................... 295
25.0 Development Support............................................................................................................................................................... 345
27.0 DC and AC Characteristics Graphs and Tables....................................................................................................................... 387
Appendix D: Migration from Baseline to Enhanced Devices..............................................................................................................394
Appendix E: Migration from Mid-Range to Enhanced Devices ..........................................................................................................395
Appendix F: Migration from High-End to Enhanced Devices.............................................................................................................395
Index .................................................................................................................................................................................................. 397
Systems Information and Upgrade Hot Line......................................................................................................................................407
PIC18F6390/6490/8390/8490 Product Identification System ............................................................................................................ 409
DS39629B-page 4Preliminary 2004 Microchip Technology Inc.
PIC18F6390/6490/8390/8490
TO OUR VALUED CUSTOMERS
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 c omm ents regarding t his publication, p lease c ontact the M arket ing Co mmunications Department via
E-mail at docerrors@mail.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)
• The Microchip Corporate Literature Center; U.S. FAX: (480) 792-7277
When contacting a sales office or the literature center, 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/cn to receive the most current information on all of our products.
DS39629B-page 6Preliminary 2004 Microchip Technology Inc.
PIC18F6390/6490/8390/8490
1.0DEVICE OVERVIEW
This documen t conta i ns dev ic e spec if i c in for m at i on fo r
the following devices:
• PIC18F6390• PIC18F8390
• PIC18F6490• PIC18F8490
This family offers the advantages of all PIC18
microcontrollers – namely, high computational
performance at an economical price. In addition to
these features, the PIC18F6390/6490/8390/8490
family introduces design enhancements that make
these microcontrollers a logical choice for many
high-performance, power sensitive applications.
1.1New Core Features
1.1.1nanoWatt TECHNOLOGY
All of the devices in the PIC18F6390/6490/8390/8490
family incorporate a range of features that can
significantly reduce power consumption during
operation. Key items include:
• Alternate Run Modes: By clocking the controller
from the Timer1 source or the internal oscillator
block, power consumption during code execution
can be reduced by as much as 90%.
• Multiple Idle Modes: The controller can also run
with its CPU core disabled, bu t the peripheral s still
active. In these st ates, powe r consumpt ion can be
reduced even further – t o as litt le as 4% of nor mal
operation requirements.
• On-the-Fly Mode Switching: The power
managed modes a re invo ked b y user code durin g
operation, allowing the user to incorporate
power-saving ideas into their application’s
software design.
• Lower Consumption in Key Modules: The
power requirements for both Timer1 and the
Watchdog Timer have been reduced by up to
80%, with typical values of 1.1 µA and 2.1 µA,
respectively.
1.1.2MULTIPLE OSCILLATOR OPTIONS
AND FEATURES
All of the devices in the PIC18F6390/6490/8390/8490
family offer nine different oscillator options, allowing
users a wide range o f choices i n develo ping applica tion
hardware. These include:
• Four Crystal modes, using crystals or ceramic
resonators.
• Two External Clock modes, offering the option of
using two pins (oscillator input and a divide-by-4
clock output) or one pin (oscillator input, with the
second pin reassigned as general I/O).
• Two External RC Oscillator modes, with the same
pin options as the External Clock modes.
• An internal oscillator block which provides an
8 MHz clock (±2% accuracy) and an INTRC
source (approximately 31kHz, stable over
temperature and V
user selectable cl oc k frequ enc ie s betw ee n
125 kHz to 4 MHz for a total of eight clock
frequencies. This option frees the two oscillator
pins for use as additional general purpose I/O.
• A Phase Lock Loop (PLL) frequency multiplier,
available to both the High-Speed Crystal and
Internal Oscillator modes, which allows clock
speeds of up to 40MHz. Used with the internal
oscillator, the PLL gives users a complete
selection of clock speeds from 31 kHz to 32 MHz
– all without using an external crystal or clock
circuit.
Besides its ava ilability as a cloc k source, the intern al
oscillator block pro vid es a s t ab le re fere nce 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 i s
switched to the internal oscillator block, 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.
• Memory Endurance: The Flas h cells for prog ram
memory are rated to last for approximately a
thousand erase/write cycles. Data retention
without refresh is conservatively estimated to be
greater than 100 years.
• Extended Instruction Set: The
PIC18F6390/6490/8390/8490 family introduces
an optional extension to th e PIC18 instr uction set,
which adds 8 new instructions and an Indexed
Addressing mode. This extension, enabled as a
device configuration option, has been specifically
designed to optimize re-entrant application code
originally developed in high-level languages such
as C.
• Enhanced Addressable USART: This serial
communication module is capable of standard
RS-232 operation an d provides support for th e LIN
bus protocol. Other enhancements include
Automatic Baud Rate Detec tion an d a 16-bit Baud
Rate Generator for improved resolu tion. When the
microcontroller is using the internal oscillator
block, the EUSART provides stable operation for
applications that talk to the outside world, without
using an external crystal (or its accompanying
power requirement).
• 10-bit A/D Converter: This module incorporates
programmable acquisition time, allowing for a
channel to be selected and a conversion to be
initiated withou t wai ting for a sampling period and
thus, reduces code overhead.
• Extended Watchdog Timer (WDT): This
enhanced version in corpora tes a 1 6-bit pre scale r,
allowing a time-out range from 4 ms to over
10 minutes that is s tabl e acros s opera ting vo lta ge
and temperature.
1.3Details on Individual Family
Members
Devices in the PIC18F 6390/6490 /8390/8490 famil y are
available in 64-pin (PIC18F6X90) and 80-pin
(PIC18F8X90) packages. Block diagrams for the two
groups are sho wn in Figure 1-1 and Figure 1-2, respectively.
The devices are differentiated from each other in three
ways:
1.I/O Ports: 7 bidirectional ports on 64-pin
devices; 9 bidirectional ports on 80-pin devices.
2.LCD Pixels: 128 (32 SEGs x 4 COMs) pixels can
be driven by 64-pin devices; 192 (48 SEGs x
4 COMs) pixels can be driven by 80-pin devices.
3.Flash Program Memory: 8 Kbytes for
PIC18FX390 devices; 16 Kbytes for PIC18FX490.
All other features fo r device s in this family are identi cal.
These are summarized in Table 1-1.
The pinouts for all devices are listed in Table 1-2 and
Table 1-3.
Like all Microchip PIC18 devices, members of the
PIC18F6390/6490/8390/8490 family are available as
both standard and low-voltage devices. Standard
devices with Flash memory, designated with an “F” in
the part number (such a s PIC18F63 90), acc ommoda te
an operating V
parts, designated by “LF” (such as PIC18LF6490),
function over an extended VDD range of 2.0V to 5.5V.
DD range of 4.2V to 5.5V. Low-voltage
DS39629B-page 8Preliminary 2004 Microchip Technology Inc.
PIC18F6390/6490/8390/8490
TABLE 1-1:DEVICE FEATURES
FeaturesPIC18F6390PIC18F6490PIC18F8390PIC18F8490
Operating FrequencyDC – 40 MHzDC – 40 MHzDC – 40 MHzDC – 40 MHz
Program Memory (Bytes)8K16K8K16K
Program Memory (Instruction s)4096819240968192
Data Memory (Bytes)768768768768
Interrupt Sources22222222
I/O PortsPorts A, B, C, D, E,
F, G
Number of pixels the LCD Driver
can drive
Timers4444
Capture/Compare/PWM Modules2222
Serial CommunicationsMSSP, AUSART
Note 1: CCP2 is multiplexed with RC1 when configuration bit CCP2MX is set, or RE7 when CCP2MX is not set.
2: RG5 is only available when MCLR
3: OSC1/CLKI and OSC2/CLKO are only available in select oscillator modes and when these pins are not being used as digital I/O.
Refer to Section 2.0 “Oscillator Configurations ” for additional information.
functionality is disabled.
DS39629B-page 10Preliminary 2004 Microchip Technology Inc.
ST= Schmitt Trigger input with CMOS levels Analog = Analog input
I= Input O= Output
P= Power OD= Open-Drain (no P diode to V
39
40
7
I
P
I
I
I
CMOS
I/O
O
O
I/O
Master Clear (input) or programming voltage (input).
ST
ST
ST
TTL
—
—
TTL
Master Clear (Reset) input. This pin is an active-low
Reset to the device.
Programming voltage inpu t.
Digital input.
Oscillator crystal or external clock input.
Oscillator crystal input or external clock source input.
ST buffer when configured in RC mode, CMOS
otherwise.
External clock source input. Always associated
with pin function OSC1. (See related OSC1/CLKI,
OSC2/CLKO pins.)
General purpose I/O pin.
Oscillator crystal or clock output.
Oscillator crystal output. Connects to crystal or
resonator in Crystal Osc ill ato r mode .
In RC mode, OSC2 pin outputs CLKO, whi ch has
1/4 the frequency of OSC1 and denotes t he
instruction cycle rate.
General purpose I/O pin.
DD)
DS39629B-page 12Preliminary 2004 Microchip Technology Inc.
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 CCP2 when configuration bit CCP2MX is set.
2: Alternate assignment for CCP2 when configuration bit CCP2MX is cleared.
49
50
9
I
P
I
I
I
CMOS
I/O
O
O
I/O
Master Clear (input) or programming voltage (input).
ST
ST
ST
TTL
—
—
TTL
Master Clear (Reset) input. This pin is an activ e-lo w
Reset to the device.
Programming voltage input.
Digital input.
Oscillator crystal or external clock input.
Oscillator crystal input or external clock source input.
ST buffer when configured in RC mode, CMOS
otherwise.
External clock source input. Always associated with
pin function OSC1. (See related OSC1/CLKI,
OSC2/CLKO pins.)
General purpose I/O pin.
Oscillator crystal or clock output.
Oscillator crystal output. Connects to crystal or
resonator in Crystal Oscillator mode.
In RC mode, OSC2 pin outputs CLKO, which has
1/4 the frequency of OSC1 and denotes the
instruction cycle rate.
General purpose I/O pin.
DD)
DS39629B-page 20Preliminary 2004 Microchip Technology Inc.