PIC16F870/871 28/40-Pin, 8-Bit CMOS FLASH Microcontrollers Devices Included in this Data Sheet: Pin Diagram PIC16F870 PIC16F871 PDIP MCLR/VPP/THV 1 40 RB7/PGD Microcontroller Core Features: RA0/AN0 2 39 RB6/PGC RA1/AN1 3 38 RB5 High performance RISC CPU RA2/AN2/VREF- 4 37 RB4 RA3/AN3/VREF+ RB3/PGM 5 36 Only 35 single word instructions to learn RA4/T0CKI RB2 6 35 All single cycle instructions except for program RA5/AN4 7 34 RB1 branches which are two-cycle RE0/RD/AN5 8 33 RB0/INT RE1/WR/AN6 VDD 9 32 Operating speed: DC - 20 MHz clock input RE2/CS/AN7 10 31 VSS DC - 200 ns instruction cycle VDD 11 30 RD7/PSP7 2K x 14 words of FLASH Program Memory VSS 12 29 RD6/PSP6 OSC1/CLKI RD5/PSP5 128 x 8 bytes of Data Memory (RAM) 13 28 OSC2/CLKO RD4/PSP4 14 27 64 x 8 bytes of EEPROM Data Memory RC0/T1OSO/T1CKI RC7/RX/DT 15 26 Pinout compatible to the PIC16CXXX 28 and RC1/T1OSI RC6/TX/CK 16 25 40-pin devices RC2/CCP1 RC5 17 24 RC3 18 23 RC4 Interrupt capability (up to 11 sources) RD0/PSP0 RD3/PSP3 19 22 Eight level deep hardware stack RD1/PSP1 20 21 RD2/PSP2 Direct, Indirect and Relative Addressing modes Power-on Reset (POR) Power-up Timer (PWRT) and Peripheral Features: Oscillator Start-up Timer (OST) Watchdog Timer (WDT) with its own on-chip RC Timer0: 8-bit timer/counter with 8-bit prescaler oscillator for reliable operation Timer1: 16-bit timer/counter with prescaler, Programmable code protection can be incremented during SLEEP via external Power saving SLEEP mode crystal/clock Selectable oscillator options Timer2: 8-bit timer/counter with 8-bit period Low power, high speed CMOS FLASH/EEPROM register, prescaler and postscaler technology One Capture, Compare, PWM module Fully static design - Capture is 16-bit, max. resolution is 12.5 ns In-Circuit Serial Programming (ICSP) via - Compare is 16-bit, max. resolution is 200 ns two pins - PWM max. resolution is 10-bit Single 5V In-Circuit Serial Programming capability 10-bit multi-channel Analog-to-Digital converter In-Circuit Debugging via two pins Universal Synchronous Asynchronous Receiver Processor read/write access to program memory Transmitter (USART/SCI) with 9-bit address Wide operating voltage range: 2.0V to 5.5V detection High Sink/Source Current: 25 mA Parallel Slave Port (PSP) 8-bits wide, with external RD, WR and CS controls (40/44-pin only) Commercial and Industrial temperature ranges Brown-out detection circuitry for Low power consumption: Brown-out Reset (BOR) - < 1.6 mA typical 5V, 4 MHz -20 A typical 3V, 32 kHz -< 1 A typical standby current 2000-2013 Microchip Technology Inc. DS30569C-page 1 PIC16F871PIC16F870/871 Pin Diagrams DIP, SOIC, SSOP 1 28 RB7/PGD MCLR/VPP/THV 2 27 RB6/PGC RA0/AN0 26 3 RB5 RA1/AN1 4 RB4 RA2/AN2/VREF- 25 5 24 RB3/PGM RA3/AN3/VREF+ 23 RB2 RA4/T0CKI 6 22 RB1 RA5/AN4 7 8 21 RB0/INT VSS 9 20 VDD OSC1/CLKI OSC2/CLKO 10 19 VSS 11 18 RC7/RX/DT RC0/T1OSO/T1CKI RC6/TX/CK RC1/T1OSI 12 17 16 RC5 RC2/CCP1 13 RC4 RC3 14 15 PLCC 39 RA4/T0CKI RB3/PGM 7 38 RA5/AN4 RB2 8 RE0/RD/AN5 37 RB1 9 RE1/WR/AN6 36 RB0/INT 10 RE2/CS/AN7 35 VDD 11 VDD PIC16F871 34 VSS 12 33 VSS RD7/PSP7 13 OSC1/CLKI 32 RD6/PSP6 14 OSC2/CLKO 31 RD5/PSP5 15 30 RD4/PSP4 RC0/T1OSO/T1CK1 16 RC7/RX/DT NC 29 17 TQFP 33 NC RC7/RX/DT 1 32 RC0/T1OSO/T1CKI RD4/PSP4 2 31 OSC2/CLKO RD5/PSP5 3 30 OSC1/CLKI RD6/PSP6 4 29 VSS RD7/PSP7 5 28 VDD SS V 6 PIC16F871 27 RE2/CS/AN7 7 VDD RE1/WR/AN6 8 26 RB0/INT RE0/RD/AN5 RB1 9 25 RA5/AN4 24 RB2 10 23 RA4/T0CKI 11 RB3/PGM DS30569C-page 2 2000-2013 Microchip Technology Inc. NC 44 12 RC6/TX/CK NC 13 43 RC5 RB4 42 14 RC4 RB5 41 15 RD3/PSP3 RB6/PGC 40 16 RD2/PSP2 RB7/PGD 39 17 RD1/PSP1 PIC16F870 MCLR/VPP/THV 38 18 RD0/PSP0 RA0/AN0 19 37 RC3 RA1/AN1 36 RC2/CCP1 20 RA2/AN2/VREF- 35 RC1/T1OSI 21 RA3/AN3/VREF+ 22 34 NC 18 6 RC1/T1OSI RA3/AN3/VREF+ RC2/CCP1 19 5 RA2/AN2/VREF- RC3 4 RA1/AN1 20 RD0/PSP0 3 21 RA0/AN0 RD1/PSP1 22 2 MCLR/VPP/THV RD2/PSP2 1 NC 23 RD3/PSP3 44 24 RB7/PGD RC4 25 43 RB6/PGC RC5 26 42 RB5 RC6/TX/CK 27 41 RB4 NC 28 40 NC