PIC16F818/819
18/20-Pin Enhanced Flash Microcontrollers
with nanoWatt Technology
Low-Power Features:
• Power-Managed modes:
- Primary Run: XT, RC oscillator,
87
A,
1 MHz, 2V
- INTRC: 7
A,
31.25 kHz, 2V
- Sleep: 0.2
A,
2V
• Timer1 oscillator: 1.8
A,
32 kHz, 2V
• Watchdog Timer: 0.7
A,
2V
• Wide operating voltage range:
- Industrial: 2.0V to 5.5V
Pin Diagram
18-Pin PDIP, SOIC
RA2/AN2/V
REF
-
RA3/AN3/V
REF
+
RA4/AN4/T0CKI
RA5/MCLR/V
PP
V
SS
RB0/INT
RB1/SDI/SDA
RB2/SDO/CCP1
RB3/CCP1/PGM
1
2
3
4
5
6
7
8
9
18
17
16
15
14
13
12
11
10
RA1/AN1
RA0/AN0
RA7/OSC1/CLKI
RA6/OSC2/CLKO
V
DD
RB7/T1OSI/PGD
RB6/T1OSO/T1CKI/PGC
RB5/SS
RB4/SCK/SCL
Oscillators:
• Three Crystal modes:
- LP, XT, HS: up to 20 MHz
• Two External RC modes
• One External Clock mode:
- ECIO: up to 20 MHz
• Internal oscillator block:
- 8 user selectable frequencies: 31 kHz, 125 kHz,
250 kHz, 500 kHz, 1 MHz, 2 MHz, 4 MHz, 8 MHz
Special Microcontroller Features:
• 100,000 erase/write cycles Enhanced Flash
program memory typical
• 1,000,000 typical erase/write cycles EEPROM
data memory typical
• EEPROM Data Retention: > 40 years
• In-Circuit Serial Programming
TM
(ICSP
TM
) via two pins
• Processor read/write access to program memory
• Low-Voltage Programming
• In-Circuit Debugging via two pins
Peripheral Features:
•
•
•
•
•
•
16 I/O pins with individual direction control
High sink/source current: 25 mA
Timer0: 8-bit timer/counter with 8-bit prescaler
Timer1: 16-bit timer/counter with prescaler, can be
incremented during Sleep via external crystal/clock
Timer2: 8-bit timer/counter with 8-bit period
register, prescaler and postscaler
Capture, Compare, PWM (CCP) module:
- Capture is 16-bit, max. resolution is 12.5 ns
- Compare is 16-bit, max. resolution is 200 ns
- PWM max. resolution is 10-bit
10-bit, 5-channel Analog-to-Digital converter
Synchronous Serial Port (SSP) with
SPI (Master/Slave) and I
2
C™ (Slave)
•
•
Program Memory
Device
Flash
(Bytes)
1792
3584
# Single-Word
Instructions
1024
2048
Data Memory
SRAM
(Bytes)
128
256
EEPROM I/O Pins
(Bytes)
128
256
16
16
10-bit
A/D (ch)
5
5
CCP
(PWM)
1
1
PIC16F818/819
SSP
SPI
Y
Y
Slave
I
2
C™
Y
Y
Timers
8/16-bit
2/1
2/1
PIC16F818
PIC16F819
2001-2013 Microchip Technology Inc.
DS39598F-page 1
PIC16F818/819
Pin Diagrams
18-Pin PDIP, SOIC
RA2/AN2/V
REF
-
RA3/AN3/V
REF
+
RA4/AN4/T0CKI
RA5/MCLR/V
PP
V
SS
RB0/INT
RB1/SDI/SDA
RB2/SDO/CCP1
RB3/CCP1/PGM
1
2
3
4
5
6
7
8
9
18
17
16
15
14
13
12
11
10
RA1/AN1
RA0/AN0
RA7/OSC1/CLKI
RA6/OSC2/CLKO
V
DD
RB7/T1OSI/PGD
RB6/T1OSO/T1CKI/PGC
RB5/SS
RB4/SCK/SCL
20-Pin SSOP
RA2/AN2/V
REF
-
RA3/AN3/V
REF
+
RA4/AN4/T0CKI
RA5/MCLR/V
PP
V
SS
V
SS
RB0/INT
RB1/SDI/SDA
RB2/SDO/CCP1
RB3/CCP1/PGM
1
2
3
4
5
6
7
8
9
10
20
19
18
17
16
15
14
13
12
11
RA1/AN1
RA0/AN0
RA7/OSC1/CLKI
RA6/OSC2/CLKO
V
DD
V
DD
RB7/T1OSI/PGD
RB6/T1OSO/T1CKI/PGC
RB5/SS
RB4/SCK/SCL
PIC16F818/819
RA4/AN4/T0CKI
RA3/AN3/V
REF
+
RA2/AN2/V
REF
-
28-Pin QFN
(1)
RA1/AN1
RA0/AN0
NC
28
27
26
25
24
23
22
NC
RA5/MCLR/V
PP
NC
V
SS
NC
V
SS
NC
RB0/INT
1
2
3
4
5
6
7
10
11
12
13
14
8
9
21
20
19
RA7/OSC1/CLKI
RA6/OSC2/CLKO
V
DD
NC
V
DD
RB7/T1OSI/PGD
RB6/T1OSO/T1CKI/PGC
PIC16F818/819
18
17
16
15
RB3/CCP1/PGM
RB2/SDO/CCP1
RB4/SCK/SCL
NC
Note 1:
For the QFN package, it is recommended that the bottom pad be connected to V
SS
.
RB1/SDI/SDA
RB5/SS
NC
DS39598F-page 2
2001-2013 Microchip Technology Inc.
PIC16F818/819
PIC16F818/819
Table of Contents
1.0 Device Overview .......................................................................................................................................................................... 5
2.0 Memory Organization ................................................................................................................................................................... 9
3.0 Data EEPROM and Flash Program Memory.............................................................................................................................. 25
4.0 Oscillator Configurations ............................................................................................................................................................ 33
5.0 I/O Ports ..................................................................................................................................................................................... 39
6.0 Timer0 Module ........................................................................................................................................................................... 53
7.0 Timer1 Module ........................................................................................................................................................................... 57
8.0 Timer2 Module ........................................................................................................................................................................... 63
9.0 Capture/Compare/PWM (CCP) Module ..................................................................................................................................... 65
10.0 Synchronous Serial Port (SSP) Module ..................................................................................................................................... 71
11.0 Analog-to-Digital Converter (A/D) Module.................................................................................................................................. 81
12.0 Special Features of the CPU...................................................................................................................................................... 89
13.0 Instruction Set Summary .......................................................................................................................................................... 103
14.0 Development Support............................................................................................................................................................... 111
15.0 Electrical Characteristics .......................................................................................................................................................... 115
16.0 DC and AC Characteristics Graphs and Tables....................................................................................................................... 141
17.0 Packaging Information.............................................................................................................................................................. 155
Appendix A: Revision History............................................................................................................................................................. 165
Appendix B: Device Differences ........................................................................................................................................................ 165
INDEX ................................................................................................................................................................................................ 167
The Microchip Web Site ..................................................................................................................................................................... 173
Customer Change Notification Service .............................................................................................................................................. 173
Customer Support .............................................................................................................................................................................. 173
Reader Response .............................................................................................................................................................................. 174
PIC16F818/819 Product Identification System .................................................................................................................................. 175
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@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.
2001-2013 Microchip Technology Inc.
DS39598F-page 3
PIC16F818/819
NOTES:
DS39598F-page 4
2001-2013 Microchip Technology Inc.
PIC16F818/819
1.0
DEVICE OVERVIEW
Device
This document contains device specific information for
the operation of the PIC16F818/819 devices. Additional
information may be found in the
“PIC
®
Mid-Range MCU
Family Reference Manual”
(DS33023) which may be
downloaded from the Microchip web site. The Reference
Manual should be considered a complementary docu-
ment to this data sheet and is highly recommended
reading for a better understanding of the device architec-
ture and operation of the peripheral modules.
The PIC16F818/819 belongs to the Mid-Range family
of the PIC
®
devices. The devices differ from each other
in the amount of Flash program memory, data memory
and data EEPROM (see Table 1-1). A block diagram of
the devices is shown in Figure 1-1. These devices con-
tain features that are new to the PIC16 product line:
• Internal RC oscillator with eight selectable
frequencies, including 31.25 kHz, 125 kHz,
250 kHz, 500 kHz, 1 MHz, 2 MHz, 4 MHz and
8 MHz. The INTRC can be configured as the
system clock via the configuration bits. Refer to
Section 4.5 “Internal Oscillator Block”
and
Section 12.1 “Configuration Bits”
for further
details.
• The Timer1 module current consumption has
been greatly reduced from 20
A
(previous PIC16
devices) to 1.8
A
typical (32 kHz at 2V), which is
ideal for real-time clock applications. Refer to
Section 6.0 “Timer0 Module”
for further details.
• The amount of oscillator selections has increased.
The RC and INTRC modes can be selected with
an I/O pin configured as an I/O or a clock output
(F
OSC
/4). An external clock can be configured
with an I/O pin. Refer to
Section 4.0 “Oscillator
Configurations”
for further details.
PIC16F819
Program
Flash
2K x14
Data
Memory
256 x 8
Data
EEPROM
256 x 8
There are 16 I/O pins that are user configurable on a
pin-to-pin basis. Some pins are multiplexed with other
device functions. These functions include:
•
•
•
•
•
•
•
•
External Interrupt
Change on PORTB Interrupt
Timer0 Clock Input
Low-Power Timer1 Clock/Oscillator
Capture/Compare/PWM
10-bit, 5-channel Analog-to-Digital Converter
SPI/I
2
C
MCLR (RA5) can be configured as an Input
Table 1-2 details the pinout of the devices with
descriptions and details for each pin.
TABLE 1-1:
AVAILABLE MEMORY IN
PIC16F818/819 DEVICES
Program
Flash
1K x 14
Data
Memory
128 x 8
Data
EEPROM
128 x 8
Device
PIC16F818
2001-2013 Microchip Technology Inc.
DS39598F-page 5