PIC16F877-04E/PQ - 8-bit MCU, 14KB Flash, 4MHz, 44-MQFP | Microchip
MPN: PIC16F877-04E/PQ β Last Time Buy| Qty | Unit Price | Extended |
|---|---|---|
| 1 | $9.85 | $9.85 |
| 10 | $8.92 | $89.20 |
| 100 | $7.65 | $765.00 |
| 500 | $6.48 | $3,240.00 |
| 1,000 | $5.72 | $5,720.00 |
PIC16F877-04E/PQ Overview
An 8-bit microcontroller (MCU) is a single-chip computer that integrates a CPU, program memory (Flash/ROM), data memory (RAM), non-volatile EEPROM, and a configurable set of peripherals (timers, ADC, USART, I/O ports, PWM, I2C/SPI). Within the semiconductor hierarchy, an MCU sits above a microprocessor (which requires external memory) and below a SoC (system-on-chip with application processor cores). The PIC16F877-04E/PQ belongs to Microchip's mid-range PIC16F877 family, which became an industry workhorse for embedded control because of its simple instruction set, deterministic timing, and rich peripheral set.
Key features of the PIC16F877-04E/PQ include 33 digital I/O pins, a 10-bit 8-channel Analog-to-Digital Converter (ADC), two 8-bit and one 16-bit timers, a USART with RS-485 support, an MSSP module (Master Synchronous Serial Port) supporting SPI and I2C (both Master and Slave), a Parallel Slave Port, a Capture/Compare/PWM module, and a watchdog timer with its own on-chip RC oscillator. The 04E speed grade denotes a 4 MHz maximum oscillator input, and the E suffix indicates the Extended (Automotive) temperature range of -40C to +125C.
The device uses a Harvard RISC architecture with separate program and data buses, providing predictable instruction execution. Its 14-bit instruction word enables most operations to complete in a single cycle, and the wide instruction encoding supports literal, register, and branch operations without dedicated move instructions.
Typical applications for the PIC16F877-04E/PQ include industrial control systems, automotive body and chassis electronics, sensor interface boards, low-power instrumentation, motor control, HVAC controls, and educational development platforms. Its 33 I/O pins comfortably support keypad scanning, LCD driving, and multi-drop communication buses.
When designing with this part, observe the brown-out reset, power-on reset, and watchdog configuration bits in the configuration word; misuse of these settings is a common cause of field returns. Also confirm that your application code fits within the 14KB Flash and 8-level hardware stack, since the PIC16F877 family lacks the extended stack and interrupt hardware of the newer PIC18 and PIC16F1xxx Enhanced mid-range families.
This page synthesizes distributor stock levels, parametric drop-in alternatives, and practical design notes that complement the manufacturer datasheet for the PIC16F877-04E/PQ.
Drop-in alternatives for PIC16F877-04E/PQ β same package, pin-to-pin compatible. Different-package parts requiring PCB rework are excluded.
Variants in this series
Same-series models that are drop-in compatible with PIC16F877-04E/PQ (same form factor and footprint) β differing in Package, RoHS Status, Timers, Communication, Core Architecture.
Quick Comparison Tool β Select alternative parts for side-by-side comparison:
PIC16F877-04/PQ
β Drop-Inπ Reference alternative (not in catalog)
PIC16F877-04I/PQ
β Drop-Inβ In Stock
$4.35 / Unit
View Datasheet βPIC16F877-20E/PQ
β Drop-Inπ Reference alternative (not in catalog)
PIC16F887-I/PQ
β Drop-Inπ Reference alternative (not in catalog)
PIC16F877A-04E/PQ
β Drop-Inπ Reference alternative (not in catalog)
PIC16F887-E/PQ
β Drop-Inπ Reference alternative (not in catalog)
PIC16F877-04E/PQ Maximum Ratings & Electrical Characteristics
| Core Architecture | PIC (8-bit RISC, Harvard) |
| Family | PIC16F877 Series |
| Program Memory (Flash) | 14 KB (8K x 14 words) |
| Data SRAM | 368 bytes |
| Data EEPROM | 256 bytes |
| Maximum CPU Frequency | 4 MHz (200 ns instruction cycle) |
| Operating Voltage (Vdd) | 2.0 V to 5.5 V |
| I/O Pins | 33 digital I/O |
| ADC | 10-bit, 8 channels |
| Timers | 2 x 8-bit, 1 x 16-bit |
| Communication | USART (RS-485), MSSP (SPI / I2C Master & Slave), PSP |
| Capture/Compare/PWM (CCP) | 1 module (16-bit) |
| Watchdog Timer | Yes, with dedicated on-chip RC oscillator |
| Instruction Set Size | 35 single-word instructions |
| Interrupt Sources | 13 |
| Package | 44-pin MQFP (10 x 10 mm), PQ suffix |
| Operating Temperature Range | -40 C to +125 C (E = Extended / Automotive) |
| Speed Grade Suffix | 04 = 4 MHz maximum oscillator |
| RoHS Status | Compliant (Pb-free MQFP) |
| Mounting Type | Surface Mount |
PIC16F877-04E/PQ Pin Configuration
| Pin 1 | MCLR/Vpp/RE3 β Master Clear (Reset) input / Programming voltage / PORTE bit 3 |
| Pin 2 | RA0/AN0 β PORTA bit 0 / Analog channel 0 |
| Pin 3 | RA1/AN1 β PORTA bit 1 / Analog channel 1 |
| Pin 4 | RA2/AN2/Vref- β PORTA bit 2 / Analog channel 2 / ADC Vref negative |
| Pin 5 | RA3/AN3/Vref+ β PORTA bit 3 / Analog channel 3 / ADC Vref positive |
| Pin 6 | RA4/T0CKI β PORTA bit 4 / Timer0 clock input (open drain) |
| Pin 7 | RA5/AN4/SS β PORTA bit 5 / Analog channel 4 / SPI Slave Select |
| Pin 8 | RE0/RD/AN5 β PORTE bit 0 / Parallel Slave Port read / Analog channel 5 |
| Pin 9 | RE1/WR/AN6 β PORTE bit 1 / Parallel Slave Port write / Analog channel 6 |
| Pin 10 | RE2/CS/AN7 β PORTE bit 2 / Parallel Slave Port chip select / Analog channel 7 |
| Pin 11 | Vdd β Positive supply (2.0 V to 5.5 V) |
| Pin 12 | Vss β Ground |
| Pin 13 | OSC1/CLKI β Crystal oscillator input / External clock input |
| Pin 14 | OSC2/CLKO β Crystal oscillator output / Clock output |
| Pin 15 | RC0/T1OSO/T1CKI β PORTC bit 0 / Timer1 oscillator output / Timer1 clock input |
| Pin 16 | RC1/T1OSI/CCP2 β PORTC bit 1 / Timer1 oscillator input / CCP2 I/O |
| Pin 17 | RC2/CCP1 β PORTC bit 2 / CCP1 PWM output |
| Pin 18 | RC3/SCK/SCL β PORTC bit 3 / SPI clock / I2C clock |
| Pin 19 | RD0/PSP0 β PORTD bit 0 / Parallel Slave Port data bit 0 |
| Pin 20 | RD1/PSP1 β PORTD bit 1 / Parallel Slave Port data bit 1 |
| Pin 21 | RD2/PSP2 β PORTD bit 2 / Parallel Slave Port data bit 2 |
| Pin 22 | RD3/PSP3 β PORTD bit 3 / Parallel Slave Port data bit 3 |
| Pin 23 | RC4/SDI/SDA β PORTC bit 4 / SPI data in / I2C data |
| Pin 24 | RC5/SDO β PORTC bit 5 / SPI data out |
| Pin 25 | RC6/TX/CK β PORTC bit 6 / USART asynchronous transmit / synchronous clock |
| Pin 26 | RC7/RX/DT β PORTC bit 7 / USART asynchronous receive / synchronous data |
| Pin 27 | RD4/PSP4 β PORTD bit 4 / Parallel Slave Port data bit 4 |
| Pin 28 | RD5/PSP5 β PORTD bit 5 / Parallel Slave Port data bit 5 |
| Pin 29 | RD6/PSP6 β PORTD bit 6 / Parallel Slave Port data bit 6 |
| Pin 30 | RD7/PSP7 β PORTD bit 7 / Parallel Slave Port data bit 7 |
| Pin 31 | Vss β Ground |
| Pin 32 | Vdd β Positive supply (2.0 V to 5.5 V) |
| Pin 33 | RB0/INT β PORTB bit 0 / External interrupt |
| Pin 34 | RB1 β PORTB bit 1 |
| Pin 35 | RB2 β PORTB bit 2 |
| Pin 36 | RB3/PGM β PORTB bit 3 / Low-voltage programming |
| Pin 37 | RB4 β PORTB bit 4 |
| Pin 38 | RB5 β PORTB bit 5 |
| Pin 39 | RB6/PGC β PORTB bit 6 / ICSP clock |
| Pin 40 | RB7/PGD β PORTB bit 7 / ICSP data |
| Pin 41 | AVdd β Analog positive supply (separate from Vdd for noise isolation) |
| Pin 42 | AVss β Analog ground (separate from Vss for noise isolation) |
| Pin 43 | NC β Not connected |
| Pin 44 | NC β Not connected |
Typical Applications
PIC16F877-04E/PQ is suitable for 6 applications: Industrial Sensor Hub, Automotive Body Control Module, HVAC Fan & Blower Controller, Educational / Hobby Development Board, Low-Power Instrumentation & Data Logger, Motor Control & PWM Drive.
Industrial Sensor Hub
The PIC16F877-04E/PQ is well suited as a multi-channel industrial sensor hub: its 10-bit 8-channel ADC reads thermistors, pressure transducers, and 4-20 mA loop sensors while the MSSP and USART drive simultaneous SPI and RS-485 buses. The 4 MHz CPU clock and 200 ns instruction cycle provide deterministic sample-to-output latency without DSP overhead. The -40 C to +125 C extended temperature grade supports factory-floor and outdoor enclosures without additional thermal conditioning. Place bypass capacitors on Vdd/Vss within 5 mm of the pins and route the analog AVdd/AVss pair separately to minimize digital switching noise coupling into ADC measurements, which preserves the 10-bit ENOB across the 0-5 V sensor span.
Recommended
Automotive Body Control Module
The PIC16F877-04E/PQ is a classic automotive body-electronics workhorse: 33 digital I/O drive door lock relays, courtesy lamps, mirror controls, and wiper stages, while the USART links to a body control CAN bridge. Its -40 C to +125 C extended grade meets under-hood and cabin thermal requirements. The 256-byte EEPROM retains learn-mode settings (window anti-pinch calibration, seat memory position) across battery disconnects. Use the 16-bit CCP module to generate accurate PWM dimming for instrument cluster backlights and verify brown-out reset settings (BOREN<1:0>) to survive crank-voltage sags down to 4 V without spurious resets.
Recommended
HVAC Fan & Blower Controller
In HVAC blower controllers the PIC16F877-04E/PQ reads NTC intake-air temperature on its ADC, drives a triac-fired AC motor via the 16-bit CCP PWM module, and modulates a closed-loop air-flow profile. The 35-instruction PIC16 RISC ISA makes the proportional + integral control loop easy to verify by hand. The extended -40 C to +125 C temperature range handles attic and rooftop installations. The on-chip watchdog timer with dedicated RC oscillator is invaluable for unattended service: a stalled main oscillator automatically triggers a system reset instead of a frozen blower, and zero-crossing detection on a CCP pin reduces triac EMI.
Recommended
Educational / Hobby Development Board
The PIC16F877-04E/PQ powers countless university courses, hobbyist trainers, and development boards thanks to its 35-instruction RISC ISA that beginners can fully grasp in one semester. The Parallel Slave Port provides a clean interface to an external bus analyzer or 8-bit host for teaching memory-mapped I/O. The PIC's Harvard architecture separates program and data memory, which pedagogically illustrates how single-cycle instructions work. Use the USART for PC serial console output at 9600 baud, the MSSP for SPI EEPROM labs, and the 10-bit ADC for analog sensor tutorials β all without external peripherals beyond an ICSP header.
Recommended
Low-Power Instrumentation & Data Logger
Battery-powered data loggers exploit the PIC16F877-04E/PQ's Sleep mode drawing under 1 uA with the watchdog timer active. The 256-byte EEPROM stores calibration constants and rolling log headers, while the 368-byte SRAM buffers samples between writes. The 10-bit ADC digitizes thermocouple, pressure, or process-current inputs, and the MSSP writes batches to an external SPI Flash. The 4 MHz speed grade keeps active current low. Implement a sample-on-interrupt wake pattern with TIMER1 gated by a 32.768 kHz crystal for sub-second scheduling accuracy across weeks of unattended logging on a single 3.6 V lithium primary cell.
Recommended
Motor Control & PWM Drive
For brushed DC or stepper motor control the PIC16F877-04E/PQ pairs its 16-bit CCP module with the 8-bit timer/counters to generate phase-correct PWM up to 20 kHz. Quadrature encoders feed TMR0 for direction and TMR1 for speed, while a hardware SPI link synchronizes with a companion motor-driver IC. The 33 I/O pins easily accommodate limit-switch inputs, brake-driver outputs, and a serial command interface. The Extended temperature grade suits industrial cabinet environments, and the watchdog timer recovers the controller from ESD-induced lockups on factory floors. Optimize dead-time insertion in firmware to prevent shoot-through in the H-bridge.
Recommended
Recommended Products Summary
Engineering reference data for PIC16F877-04E/PQ β comparison, design guidance, and compliance information.
Selection Guide
Comparison with Alternatives
| Parameter | This Product | PIC16F877-04/PQ | PIC16F877-04I/PQ | PIC16F877-20E/PQ | PIC16F887-I/PQ | PIC16F877A-04E/PQ | PIC16F887-E/PQ |
|---|---|---|---|---|---|---|---|
| Brand | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology |
| Package | 44-MQFP (PQ) 10x10 mm | 44-MQFP (PQ) 10x10 mm | 44-MQFP (PQ) 10x10 mm | 44-MQFP (PQ) 10x10 mm | 44-MQFP (PQ) 10x10 mm | 44-MQFP (PQ) 10x10 mm | 44-MQFP (PQ) 10x10 mm |
| Maximum CPU Frequency | 4 MHz | 4 MHz | 4 MHz | 20 MHz | 20 MHz | 4 MHz | 20 MHz |
| Flash Memory | 14 KB | 14 KB | 14 KB | 14 KB | 14 KB | 14 KB | 14 KB |
| SRAM | 368 B | 368 B | 368 B | 368 B | 368 B | 368 B | 368 B |
| Operating Temperature | -40 C to +125 C (Extended) | 0 C to +70 C (Commercial) | -40 C to +85 C (Industrial) | -40 C to +125 C (Extended) | -40 C to +85 C (Industrial) | -40 C to +125 C (Extended) | -40 C to +125 C (Extended) |
| ADC Channels / Resolution | 8 / 10-bit | 8 / 10-bit | 8 / 10-bit | 8 / 10-bit | 14 / 10-bit | 8 / 10-bit | 14 / 10-bit |
| I/O Pins | 33 | 33 | 33 | 33 | 36 | 33 | 36 |
| Lifecycle Status | Last Time Buy (Legacy) | Last Time Buy | Last Time Buy | Last Time Buy | Active (Recommended replacement) | Last Time Buy | Active |
Key Differentiators
- Extended -40 C to +125 C automotive temperature grade in the same MQFP-44 package (vs PIC16F877-04/PQ)
- Modern drop-in successor with 5x more CPU throughput (vs PIC16F887-I/PQ)
- A-silicon revision with improved brown-out and LVP (vs PIC16F877-04E/PQ vs PIC16F877A-04E/PQ)
Design Notes
Estimated: at 5 V Vdd, 4 MHz clock and full I/O load the PIC16F877-04E/PQ draws approximately 5-10 mA active. Connect a 0.1 uF ceramic bypass capacitor within 5 mm of Vdd (pin 11) and another on Vdd (pin 32), plus a 10 uF bulk capacitor near the supply pin pair. For ADC accuracy, decouple AVdd (pin 41) separately through a ferrite bead and a 0.1 uF + 10 uF combination; AVss (pin 42) should return directly to the ground plane via a short, low-inductance trace to avoid reference noise coupling.
Route the quartz crystal traces between OSC1 (pin 13) and OSC2 (pin 14) as short, symmetric traces with a grounded guard ring to minimize EMI pickup. Place the two load capacitors (typically 15-33 pF) immediately adjacent to the MCU pins. If a resonator or external clock is used instead, drive OSC1 only and leave OSC2 floating. The MCLR/RE3 pin (pin 1) requires a 10 kohm pull-up to Vdd; do not connect MCLR directly to Vdd without a resistor, otherwise in-circuit serial programming (ICSP) cannot drive the line low to enter programming mode.
Three common pitfalls with the PIC16F877-04E/PQ: (1) configuration-word mistakes β set FOSC, WDTE, PWRTE, BOREN and LVP bits to match the design; a misconfigured watchdog will reset the part every few ms, and an unintended LVP pin disables RB5 as I/O. (2) ADC input impedance β the ADC requires a source impedance below 2.5 kohm for full 10-bit accuracy; add an op-amp buffer for higher-impedance sensors. (3) Stack depth β the PIC16F877 hardware stack is only 8 levels deep; deep interrupt nesting or recursive function calls overflow it silently. Use inline functions or restructure to keep call depth shallow.
The PIC16F877-04E/PQ's Parallel Slave Port (port D plus RE0/RE1/RE2) is intended for short-distance communication to a host microprocessor or FIFO. Keep PSP traces under 50 mm, source-terminate with 100 ohm resistors if the bus is longer, and place a 10 kohm pull-up on RE2/CS to prevent spurious deselect during MCU reset. For USART RS-485 communications at 115200 baud or above, add a 120 ohm termination at the bus ends and route the differential pair with controlled impedance; the USART does not include internal slew-rate limiting.
Compliance Information
Pb-free MQFP per Microchip product page. AEC-Q100 not formally stated for PIC16F877-04E; automotive qualification pursued at system level. REACH and RoHS per EU directives as of 2026-09-21.