PIC18F6525/6621/8525/8621
64/80-Pin High-Performance, 64-Kbyte Enhanced Flash
Microcontrollers with A/D
High Performance RISC CPU:
•
•
•
•
Linear program memory addressing to 64 Kbytes
Linear data memory addressing to 4 Kbytes
1 Kbyte of data EEPROM
Up to 10 MIPs operation:
- DC – 40 MHz osc./clock input
- 4 MHz – 10 MHz osc./clock input with PLL active
16-bit wide instructions, 8-bit wide data path
Priority levels for interrupts
31-level, software accessible hardware stack
8 x 8 Single-cycle Hardware Multiplier
High current sink/source 25 mA/25 mA
Four external interrupt pins
Timer0 module: 8-bit/16-bit timer/counter
Timer1 module: 16-bit timer/counter
Timer2 module: 8-bit timer/counter
Timer3 module: 16-bit timer/counter
Timer4 module: 8-bit timer/counter
Secondary oscillator clock option – Timer1/Timer3
Two Capture/Compare/PWM (CCP) modules:
- Capture is 16-bit, max. resolution 6.25 ns (T
CY
/16)
- Compare is 16-bit, max. resolution 100 ns (T
CY
)
- PWM output: 1 to 10-bit PWM resolution
Three Enhanced Capture/Compare/PWM (ECCP)
modules:
- Same Capture/Compare features as CCP
- One, two or four PWM outputs
- Selectable polarity
- Programmable dead time
- Auto-Shutdown on external event
- Auto-Restart
Master Synchronous Serial Port (MSSP) module
with two modes of operation:
- 2/3/4-wire SPI (supports all 4 SPI modes)
- I
2
C™ Master and Slave mode
Two Enhanced USART modules:
- Supports RS-485, RS-232 and LIN 1.2
- Auto-Wake-up on Start bit
- Auto-Baud Rate Detect
Parallel Slave Port (PSP) module
Program Memory
Device
Data Memory
10-bit
A/D
(ch)
12
12
16
16
External Memory Interface
(PIC18F8525/8621 Devices Only):
• Address capability of up to 2 Mbytes
• 16-bit interface
Analog Features:
• 10-bit, up to 16-channel Analog-to-Digital
Converter (A/D):
- Auto-Acquisition
- Conversion available during Sleep
• Programmable 16-level Low-Voltage Detection
(LVD) module:
- Supports interrupt on Low-Voltage Detection
• Programmable Brown-out Reset (BOR)
• Dual analog comparators:
- Programmable input/output configuration
•
•
•
•
•
•
•
•
•
•
•
•
•
Peripheral Features:
Special Microcontroller Features:
• 100,000 erase/write cycle Enhanced Flash
program memory typical
• 1,000,000 erase/write cycle Data EEPROM
memory typical
• 1 second programming time
• Flash/Data EEPROM Retention: > 100 years
• Self-reprogrammable under software control
• Power-on Reset (POR), Power-up Timer (PWRT)
and Oscillator Start-up Timer (OST)
• Watchdog Timer (WDT) with its own On-Chip
RC Oscillator for reliable operation
• Programmable code protection
• Power-saving Sleep mode
• Selectable oscillator options including:
- 4x Phase Lock Loop (PLL) – of primary oscillator
- Secondary Oscillator (32 kHz) clock input
• In-Circuit Serial Programming™ (ICSP™) via two pins
• MPLAB
®
In-Circuit Debug (ICD 2) via two pins
•
•
CMOS Technology:
•
•
•
•
Low power, high-speed Flash technology
Fully static design
Wide operating voltage range (2.0V to 5.5V)
Industrial and Extended temperature ranges
•
•
# Single-Word SRAM EEPROM I/O
Bytes Instructions (bytes) (bytes)
48K
64K
48K
64K
24576
32768
24576
32768
3840
3840
3840
3840
1024
1024
1024
1024
53
53
70
70
CCP/
MSSP/SPI™/
Timers
ECCP PWM Master I
2
C™ EUSART 8-bit/16-bit EMI
2/3
2/3
2/3
2/3
14
14
14
14
Y
Y
Y
Y
2
2
2
2
2/3
2/3
2/3
2/3
N
N
Y
Y
PIC18F6525
PIC18F6621
PIC18F8525
PIC18F8621
2003-2013 Microchip Technology Inc.
DS39612C-page 1
PIC18F6525/6621/8525/8621
Pin Diagrams
64-Pin TQFP
RE7/ECCP2
(1)
/P2A
(1)
RE2/CS/P2B
RD0/PSP0
RD1/PSP1
RD2/PSP2
RD3/PSP3
RD4/PSP4
RD5/PSP5
RD6/PSP6
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
RD7/PSP7
RE3/P3C
RE5/P1C
RE4/P3B
RE6/P1B
V
DD
V
SS
RE1/WR/P2C
RE0/RD/P2D
RG0/ECCP3/P3A
RG1/TX2/CK2
RG2/RX2/DT2
RG3/CCP4/P3D
MCLR/V
PP
/RG5
(2)
RG4/CCP5/P1D
V
SS
V
DD
RF7/SS
RF6/AN11
RF5/AN10/CV
REF
RF4/AN9
RF3/AN8
RF2/AN7/C1OUT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
RB0/INT0/FLT0
RB1/INT1
RB2/INT2
RB3/INT3
RB4/KBI0
RB5/KBI1/PGM
RB6/KBI2/PGC
V
SS
OSC2/CLKO/RA6
OSC1/CLKI
V
DD
RB7/KBI3/PGD
RC5/SDO
RC4/SDI/SDA
RC3/SCK/SCL
RC2/ECCP1/P1A
PIC18F6525
PIC18F6621
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
RF1/AN6/C2OUT
RF0/AN5
RA2/AN2/V
REF
-
RA4/T0CKI
RC1/T1OSI/ECCP2
(1)
/P2A
(1)
Note 1:
2:
ECCP2/P2A are multiplexed with RC1 when CCP2MX is set, or RE7 when CCP2MX is not set.
RG5 is multiplexed with MCLR and is only available when the MCLR Resets are disabled.
RC0/T1OSO/T13CKI
AV
SS
RA3/AN3/V
REF
+
RA5/AN4/LVDIN
DS39612C-page 2
RC7/RX1/DT1
RC6/TX1/CK1
RA1/AN1
RA0/AN0
AV
DD
V
DD
V
SS
2003-2013 Microchip Technology Inc.
PIC18F6525/6621/8525/8621
Pin Diagrams (Cont.’d)
80-Pin TQFP
RE7/AD15/ECCP2
(1)
/P2A
(1)
RE2/AD10/CS/P2B
RE5/AD13/P1C
(2)
RE4/AD12/P3B
(2)
RE3/AD11/P3C
(2)
RE6/AD14/P1B
(2)
RD0/AD0/PSP0
RD1/AD1/PSP1
RD2/AD2/PSP2
RD3/AD3/PSP3
RD4/AD4/PSP4
RD5/AD5/PSP5
RD6/AD6/PSP6
RH1/A17
RH0/A16
RD7/AD7/PSP7
RJ0/ALE
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61
RH2/A18
RH3/A19
RE1/AD9/WR/P2C
RE0/AD8/RD/P2D
RG0/ECCP3/P3A
RG1/TX2/CK2
RG2/RX2/DT2
RG3/CCP4/P3D
MCLR/V
PP
/RG5
(3)
RG4/CCP5/P1D
V
SS
V
DD
RF7/SS
RF6/AN11
RF5/AN10/CV
REF
RF4/AN9
RF3/AN8
RF2/AN7/C1OUT
RH7/AN15/P1B
(2)
RH6/AN14/P1C
(2)
RJ1/OE
V
DD
V
SS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
RJ2/WRL
RJ3/WRH
RB0/INT0/FLT0
RB1/INT1
RB2/INT2
RB3/INT3/ECCP2
(1)
/P2A
(1)
RB4/KBI0
RB5/KBI1/PGM
RB6/KBI2/PGC
V
SS
OSC2/CLKO/RA6
OSC1/CLKI
V
DD
RB7/KBI3/PGD
RC5/SDO
RC4/SDI/SDA
RC3/SCK/SCL
RC2/ECCP1/P1A
RJ7/UB
RJ6/LB
PIC18F8525
PIC18F8621
RF1/AN6/C2OUT
RF0/AN5
RJ4/BA0
RA2/AN2/V
REF
-
RA4/T0CKI
RC1/T1OSI/ECCP2
(1)
/P2A
(1)
Note 1:
2:
3:
ECCP2/P2A are multiplexed with RC1 when CCP2MX is set; with RE7 when CCP2MX is cleared and the device
is configured in Microcontroller mode; or with RB3 when CCP2MX is cleared in all other program memory modes.
P1B/P1C/P3B/P3C are multiplexed with RE6:RE3 when ECCPMX is set and with RH7:RH4 when ECCPMX is
not set.
RG5 is multiplexed with MCLR and is only available when the MCLR Resets are disabled.
2003-2013 Microchip Technology Inc.
RC0/T1OSO/T13CKI
AV
SS
RA3/AN3/V
REF
+
RH5/AN13/P3B
(2)
RH4/AN12/P3C
(2)
RA5/AN4/LVDIN
RC7/RX1/DT1
RC6/TX1/CK1
RA1/AN1
RA0/AN0
RJ5/CE
AV
DD
V
DD
V
SS
DS39612C-page 3
PIC18F6525/6621/8525/8621
Table of Contents
1.0 Device Overview .......................................................................................................................................................................... 7
2.0 Oscillator Configurations ............................................................................................................................................................ 21
3.0 Reset .......................................................................................................................................................................................... 29
4.0 Memory Organization ................................................................................................................................................................. 39
5.0 Flash Program Memory .............................................................................................................................................................. 61
6.0 External Memory Interface ......................................................................................................................................................... 71
7.0 Data EEPROM Memory ............................................................................................................................................................. 79
8.0 8 x 8 Hardware Multiplier............................................................................................................................................................ 85
9.0 Interrupts .................................................................................................................................................................................... 87
10.0 I/O Ports ................................................................................................................................................................................... 103
11.0 Timer0 Module ......................................................................................................................................................................... 131
12.0 Timer1 Module ......................................................................................................................................................................... 135
13.0 Timer2 Module ......................................................................................................................................................................... 141
14.0 Timer3 Module ......................................................................................................................................................................... 143
15.0 Timer4 Module ......................................................................................................................................................................... 147
16.0 Capture/Compare/PWM (CCP) Modules ................................................................................................................................. 149
17.0 Enhanced Capture/Compare/PWM (ECCP) Module................................................................................................................ 157
18.0 Master Synchronous Serial Port (MSSP) Module .................................................................................................................... 173
19.0 Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) ............................................................... 213
20.0 10-Bit Analog-to-Digital Converter (A/D) Module ..................................................................................................................... 233
21.0 Comparator Module.................................................................................................................................................................. 243
22.0 Comparator Voltage Reference Module ................................................................................................................................... 249
23.0 Low-Voltage Detect .................................................................................................................................................................. 253
24.0 Special Features of the CPU .................................................................................................................................................... 259
25.0 Instruction Set Summary .......................................................................................................................................................... 275
26.0 Development Support............................................................................................................................................................... 317
27.0 Electrical Characteristics .......................................................................................................................................................... 323
28.0 DC and AC Characteristics Graphs And Tables ...................................................................................................................... 357
29.0 Packaging Information.............................................................................................................................................................. 373
Appendix A: Revision History............................................................................................................................................................. 377
Appendix B: Device Differences......................................................................................................................................................... 377
Appendix C: Conversion Considerations ........................................................................................................................................... 378
Appendix D: Migration From Mid-Range to Enhanced Devices......................................................................................................... 378
Appendix E: Migration From High-End to Enhanced Devices............................................................................................................ 379
Index .................................................................................................................................................................................................. 381
On-Line Support................................................................................................................................................................................. 391
Systems Information and Upgrade Hot Line ...................................................................................................................................... 391
Reader Response .............................................................................................................................................................................. 392
PIC18F6525/6621/8525/8621 Product Identification System ............................................................................................................ 393
DS39612C-page 4
2003-2013 Microchip Technology Inc.
PIC18F6525/6621/8525/8621
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 comments regarding this publication, please contact the Marketing Communications 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 liter-
ature 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.
2003-2013 Microchip Technology Inc.
DS39612C-page 5