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