Document
PIC16F87XA
28/40/44-Pin Enhanced Flash Microcontrollers
Devices Included in this Data Sheet:
• PIC16F873A • PIC16F874A
• PIC16F876A • PIC16F877A
High-Performance RISC CPU:
• Only 35 single-word instructions to learn • All single-cycle instructions except for program
branches, which are two-cycle • Operating speed: DC – 20 MHz clock input
DC – 200 ns instruction cycle • Up to 8K x 14 words of Flash Program Memory,
Up to 368 x 8 bytes of Data Memory (RAM), Up to 256 x 8 bytes of EEPROM Data Memory • Pinout compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXX microcontrollers
Peripheral Features:
• 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 • Two Capture, Compare, PWM modules - 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 • Synchronous Serial Port (SSP) with SPI (Master mode) and I2C™(Master/Slave) • Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address detection • Parallel Slave Port (PSP) – 8 bits wide with external RD, WR and CS controls (40/44-pin only) • Brown-out detection circuitry for Brown-out Reset (BOR)
Analog Features:
• 10-bit, up to 8-channel Analog-to-Digital Converter (A/D)
• Brown-out Reset (BOR) • Analog Comparator module with:
- Two analog comparators - Programmable on-chip voltage reference
(VREF) module - Programmable input multiplexing from device
inputs and internal voltage reference - Comparator outputs are externally accessible
Special Microcontroller Features:
• 100,000 erase/write cycle Enhanced Flash program memory typical
• 1,000,000 erase/write cycle Data EEPROM memory typical
• Data EEPROM Retention > 40 years • Self-reprogrammable under software control • In-Circuit Serial Programming™ (ICSP™)
via two pins • Single-supply 5V In-Circuit Serial Programming • Watchdog Timer (WDT) with its own on-chip RC
oscillator for reliable operation • Programmable code protection • Power saving Sleep mode • Selectable oscillator options • In-Circuit Debug (ICD) via two pins
CMOS Technology:
• Low-power, high-speed Flash/EEPROM technology
• Fully static design • Wide operating voltage range (2.0V to 5.5V) • Commercial and Industrial temperature ranges • Low-power consumption
Device
Program Memory
Bytes
# Single Word Instructions
Data SRAM (Bytes)
EEPROM (Bytes)
I/O
MSSP
10-bit CCP
A/D (ch)
(PWM)
SPI
Master I2C
USART
Timers 8/16-bit
Comparators
PIC16F873A 7.2K
4096
192
128 22
5
2 Yes Yes
Yes
2/1
2
PIC16F874A 7.2K
4096
192
128 33
8
2 Yes Yes
Yes
2/1
2
PIC16F876A 14.3K
8192
368
256 22
5
2 Yes Yes
Yes
2/1
2
PIC16F877A 14.3K
8192
368
256 33
8
2 Yes Yes
Yes
2/1
2
2001-2013 Microchip Technology Inc.
DS39582C-page 1
PIC16F87XA
Pin Diagrams
28-Pin PDIP, SOIC, SSOP
MCLR/VPP
1
RA0/AN0
2
RA1/AN1
3
RA2/AN2/VREF-/CVREF
4
RA3/AN3/VREF+
5
RA4/T0CKI/C1OUT
6
RA5/AN4/SS/C2OUT
7
VSS
8
OSC1/CLKI
9
OSC2/CLKO
10
RC0/T1OSO/T1CKI
11
RC1/T1OSI/CCP2
12
RC2/CCP1
13
RC3/SCK/SCL
14
44-Pin QFN
PIC16F873A/876A
8
28
RB7/PGD
27
RB6/PGC
26
RB5
25
RB4
24
RB3/PGM
23
RB2
22
RB1
21
RB0/INT
20
VDD
19
VSS
18
RC7/RX/DT
17
RC6/TX/CK
16
RC5/SDO
15
RC4/SDI/SDA
28-Pin QFN
RB6/PGC
RB7/PGD
MCLR/VPP
RA0/AN0
RA1/AN1
RB4
RB5
22
23
24
25
26
27
28
RA2/AN2/VREF-/CVREF RA3/AN3/VREF+
RA4/T0CKI/C1OUT RA5/AN4/SS/C2OUT
VSS OSC1/CLKI OSC2/CLKO
1
21
2
20
3 PIC16F873A 19
4 5
PIC16F876A
18 17
6
16
7
15
RB3/PGM RB2 RB1 RB0/INT VDD VSS
RC7/RX/DT
9
10
11
12
13
14
RC6/TX/CK
RC5/SDO
RC4/SDI/SDA
RC3/SCK/SCL
RC2/CCP1
RC1/T1OSI/CCP2
RC0/T1OSO/T1CKI
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2
RC2/CCP1
RC3/SCK/SCL
RD0/PSP0
RD1/PSP1
RD2/PSP2
RD3/PSP3
RC4/SDI/SDA
RC5/SDO
RC6/TX/CK
34
35
36
37
38
39
40
41
42
43
44
RC7/RX/DT RD4/PSP4 RD5/PSP5 RD6/PSP6 RD7/PSP7
VSS VDD VDD RB0/INT RB1 RB2
1
33
2
32
3
31
4
30
5
PIC16F874A 29
6 7
PIC16F877A
28 27
8
26
9
25
10
24
11
23
OSC2/CLKO
OSC1/CLKI VSS
VSS VDD VDD RE2/CS/AN7
RE1/WR/AN6
RE0/RD/AN5
RA5/AN4/SS/C2OUT RA4/T0CKI/C1OUT
22
21
20
19
18
17
16
15
14
13
12
RA3/AN3/VREF+
RA2/AN2/VREF-/CVREF
RA1/AN1
RA0/AN0
MCLR/VPP
RB7/PGD
RB6/PGC
RB5
RB4
NC
RB3/PGM
DS39582C-page 2
2001-2013 Microchip Technology Inc.
PIC16F87XA
Pin Diagrams (Continued)
40-Pin PDIP
MCLR/VPP
1
40
RA0/AN0
2
39
RA1/AN1
3
38
RA2/AN2/VREF-/CVREF
4
37
RA3/AN3/VREF+
5
36
RA4/T0CKI/C1OUT
6
35
PIC16F874A/877A
RA5/AN4/SS/C2OUT
7
34
RE0/RD/AN5
8
33
RE1/WR/AN6
9
32
RE2/CS/AN7
10
31
VDD
11
30
VSS
12
29
OSC1/CLKI
13
28
OSC2/CLKO
14
27
RC0/T1OSO/T1CKI
15
26
RC1/T1OSI/CCP2
16
25
RC2/CCP1
17
24
RC3/SCK/SC.