PIC16F628-04/P - 8-Bit 4MHz 3.5KB Flash MCU | Microchip DIP-18
MPN: PIC16F628-04/P ✗ End of Life| Qty | Unit Price | Extended |
|---|---|---|
| 1 | $3.84 | $3.84 |
| 10 | $3.45 | $34.50 |
| 100 | $2.99 | $299.00 |
| 500 | $2.65 | $1,325.00 |
| 1,000 | $2.35 | $2,350.00 |
PIC16F628-04/P Overview
A PIC microcontroller (MCU) is a compact, self-contained computer-on-a-chip integrating an 8-bit CPU, non-volatile Flash program memory, RAM, EEPROM data memory, and configurable digital I/O on a single die. PIC16 mid-range parts (PIC16 -> PIC microcontroller family -> 8-bit MCU -> microcontroller -> embedded processor) target cost-sensitive, deterministic embedded designs where predictable instruction timing, low power, and ease of programming with the free MPLAB X IDE outweigh the throughput of 32-bit Cortex-M devices.
Key features of the PIC16F628-04/P include 16 digital I/O pins with independent direction control, two analog comparators, a capture/compare/PWM (CCP) module, an enhanced USART for serial communications, an internal 4 MHz oscillator option, and a wide operating voltage range of 3.0 V to 5.5 V. The device consumes very low quiescent current in Sleep mode (typically < 1 uA) and supports in-circuit serial programming (ICSP) through two pins, eliminating the need for a separate programmer socket.
Architecturally, the PIC16F628 uses a Harvard design with separate program and data buses, a hardware multiplier-free ALU, and direct register-mapped I/O that gives the core its signature deterministic 1-cycle instruction execution except for branches. The 4 MHz speed grade limits the oscillator input frequency to 4 MHz (8 MHz internal /2) but the same silicon is offered in -20 variants for 20 MHz operation, and pin-compatible upgrades include the PIC16F628A-I/P with the enhanced nanowatt silicon and 20 MHz maximum frequency.
Typical applications include low-cost consumer appliances, hobbyist and educational projects, simple motor and lighting controllers, battery-powered sensor nodes, and legacy industrial replacement boards. The DIP-18 package remains popular for breadboarding, training kits, and through-hole production runs where field serviceability is valued.
When designing with this MCU, derate oscillator frequency below 4 MHz to ensure timing margins across temperature, and reserve the ICSPDAT/ICSPCLK pins (RB7/RB6) so the device can be reprogrammed on the board without removing it.
This page synthesizes distributor pricing, drop-in alternatives, and practical design notes not found in the manufacturer datasheet alone, and is verified against Microchip's published PIC16F628 datasheet.
Drop-in alternatives for PIC16F628-04/P — 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 PIC16F628-04/P (same form factor and footprint) — differing in RoHS Status, Operating Temperature, Package, Mounting Type, Core Architecture.
Quick Comparison Tool — Select alternative parts for side-by-side comparison:
PIC16F628-04I/P
✅ Drop-In✓ In Stock
$2.16 / Unit
View Datasheet →PIC16F628A-I/P
✅ Drop-In✓ In Stock
$1.62 / Unit
View Datasheet →PIC16F627-04/P
✅ Drop-In✓ In Stock
$2.05 / Unit
View Datasheet →PIC16F84A-04/P
✅ Drop-In📋 Reference alternative (not in catalog)
PIC16F648A-I/P
✅ Drop-In✓ In Stock
$2.32 / Unit
View Datasheet →PIC16F628-04/P Maximum Ratings & Electrical Characteristics
| Core Architecture | PIC16 enhanced mid-range 8-bit RISC |
| Instruction Set | 35 single-word instructions |
| Program Memory | 3.5 KB Flash (2K x 14 words) |
| RAM | 224 bytes |
| EEPROM | 128 bytes |
| Maximum Oscillator Frequency (this -04 grade) | 4 MHz |
| Instruction Cycle Time | 200 ns at 4 MHz |
| Supply Voltage | 3.0 V to 5.5 V (typical 4.5 V to 5.5 V at full speed) |
| Digital I/O Pins | 16 (bidirectional, TTL/CMOS selectable) |
| Analog Comparators | 2 on-chip |
| Capture/Compare/PWM (CCP) | 1 module, 10-bit PWM |
| USART | 1 enhanced USART (LIN-capable) |
| Timers | Timer0, Timer1 (16-bit), Timer2 (8-bit with PWM) |
| Internal Oscillator | 4 MHz internal RC (software-selectable) |
| Reset / Watchdog | Power-on Reset, Brown-out Reset, WDT with separate oscillator |
| In-Circuit Programming | ICSP via RB6/RB7 |
| Package | 18-pin PDIP (DIP-18) |
| Operating Temperature | 0C to +70C (commercial) |
| Mounting Type | Through-hole (DIP) |
| RoHS Status | Lead-free / RoHS-compliant per DigiKey listing |
PIC16F628-04/P Pin Configuration
| Pin 1 | RA2/AN2 — Digital I/O / analog input channel 2 |
| Pin 2 | RA3/AN3/VREF+ — Digital I/O / analog input / positive voltage reference |
| Pin 3 | RA4/T0CKI — Digital I/O / Timer0 clock input (open-drain) |
| Pin 4 | RA5/MCLR/VPP — Digital I/O / Master Clear reset (active low) / programming voltage |
| Pin 5 | VSS — Ground reference |
| Pin 6 | RB0/INT — Digital I/O / external interrupt |
| Pin 7 | RB1/RX/DT — Digital I/O / USART RX / synchronous data |
| Pin 8 | RB2/TX/CK — Digital I/O / USART TX / synchronous clock |
| Pin 9 | RB3/CCP1 — Digital I/O / Capture/Compare/PWM channel 1 |
| Pin 10 | RB4/PGM — Digital I/O / LVP programming |
| Pin 11 | RB5 — Digital I/O |
| Pin 12 | RB6/ICSPCLK — Digital I/O / ICSP serial clock |
| Pin 13 | RB7/ICSPDAT — Digital I/O / ICSP serial data |
| Pin 14 | VDD — Positive supply voltage (3.0 V to 5.5 V) |
| Pin 15 | RA6/OSC2/CLKOUT — Digital I/O / crystal oscillator output / clock output |
| Pin 16 | RA7/OSC1/CLKIN — Digital I/O / crystal oscillator input / external clock input |
| Pin 17 | RA0/AN0 — Digital I/O / analog input channel 0 |
| Pin 18 | RA1/AN1 — Digital I/O / analog input channel 1 |
Typical Applications
PIC16F628-04/P is suitable for 6 applications: Hobbyist & Educational Projects, Industrial Control Replacement Boards, Battery-Powered Sensor Nodes, Simple Motor & Lighting Controllers, Automotive Aftermarket & Hobbyist Vehicles, Low-Cost Consumer Appliance Control.
Hobbyist & Educational Projects
The PIC16F628-04/P is the canonical Microchip MCU for breadboard-friendly learning kits because its DIP-18 package fits standard 0.3-inch-wide breadboard sockets and its 18 pins keep the wiring manageable for first-time embedded learners. The 4 MHz oscillator grade means simple timing calculations (1 cycle = 1 us at 4 MHz clock), which helps students understand instruction execution without timekeeping complexity. With 35 single-word instructions, the PIC16F628 is ideal for teaching assembly fundamentals while still offering enough RAM (224 B) and Flash (3.5 KB) to run practical C programs under MPLAB X IDE. The PIC16F628-04/P is widely used in PIC microcontroller training labs, EE course curricula, and DIY maker projects for blinking LEDs, reading pushbuttons, and driving seven-segment displays. Recommended companions: PICkit 4 in-circuit programmer for ICSP programming and MPLAB X IDE for development.
Recommended
Industrial Control Replacement Boards
Long-life industrial equipment often needs replacement microcontrollers decades after launch, and the PIC16F628-04/P continues to serve this role because Microchip's PIC16 mid-range parts have been in continuous production since the late 1990s. The device's wide 3.0 V to 5.5 V supply tolerance accommodates the 5 V logic of legacy PLCs, motor drives, and instrumentation front-ends, while its 4 MHz oscillator grade yields deterministic instruction timing required for safety-critical control loops. The on-chip USART enables RS-232/RS-485 communication with industrial sensors and HMIs, and the dual analog comparators let designers implement window detectors or zero-crossing detection without external op-amps. The DIP-18 package also makes field replacement possible without surface-mount rework, which is critical for service technicians on legacy production lines.
Recommended
Battery-Powered Sensor Nodes
The PIC16F628-04/P is well-suited to battery-powered sensor nodes that spend most of their life in Sleep mode and wake periodically to read sensors and transmit data. Its Sleep current is typically < 1 uA, so a 3 V lithium coin cell can power a wake-every-30-seconds node for several years. The internal 4 MHz RC oscillator eliminates the external crystal, reducing BOM cost and board area for cost-sensitive wireless sensor designs. The 128-byte EEPROM provides non-volatile storage for calibration constants and node IDs without external memory, and the USART can drive low-power RF modules or 4-20 mA current loops. The 16 digital I/O pins accommodate multiple sensor channels and LED status indicators in a compact 18-pin footprint.
Recommended
Simple Motor & Lighting Controllers
The PIC16F628-04/P's CCP module can generate 10-bit PWM signals suitable for brushed DC motor speed control, LED dimming, and small solenoid drivers. The 16 digital I/O pins can read multiple pushbuttons, rotary encoders, or Hall-effect sensors, while the dual analog comparators provide overcurrent or overvoltage protection through hardware interrupt. At 4 MHz oscillator input, the PWM module produces up to 9.7 kHz at 10-bit resolution, well above the audible band and sufficient to avoid motor whine. Combined with the USART, the device can accept external commands from a host controller or Bluetooth module for smart-home lighting and DC fan control applications. The through-hole DIP package simplifies prototyping and field service.
Recommended
Automotive Aftermarket & Hobbyist Vehicles
Although the commercial-temperature PIC16F628-04/P is not AEC-Q100 qualified, it remains popular in hobbyist automotive projects such as aftermarket gauge controllers, fuel-saver displays, and PWM cooling fan controllers. The 4 MHz oscillator grade produces predictable timing for RPM sampling and pulse counting from ignition coils, and the USART interfaces to Bluetooth OBD-II bridges for telemetry displays. The DIP-18 package is easy to swap in and out of vehicle-mounted enclosures, and the analog comparators detect zero-crossing events from inductive pickup coils. For production automotive designs, Microchip recommends migrating to AEC-Q100-qualified PIC16F variants; the PIC16F628A-I/P industrial temperature variant is the typical upgrade for underhood environments.
Recommended
Low-Cost Consumer Appliance Control
The PIC16F628-04/P's combination of 3.5 KB Flash, 128-byte EEPROM, and built-in peripherals makes it a cost-effective controller for small consumer appliances such as coffee makers, bread machines, fans, and decorative LED strips. The 18-pin DIP variant is favored for low-volume appliance products and white-goods field serviceability, where the through-hole package withstands thermal cycling and mechanical stress better than fine-pitch SMD. The internal 4 MHz oscillator keeps the BOM small, the USART enables firmware update via the appliance's USB-to-serial bridge, and the analog comparators can detect zero-crossing of the AC line for triac dimming. The PIC16F628-04/P's deterministic 200 ns instruction cycle simplifies coding of state machines that drive relays, solenoids, and seven-segment displays.
Recommended
Recommended Products Summary
Engineering reference data for PIC16F628-04/P — comparison, design guidance, and compliance information.
Selection Guide
Comparison with Alternatives
| Parameter | This Product | PIC16F628-04I/P | PIC16F628A-I/P | PIC16F627-04/P | PIC16F84A-04/P | PIC16F648A-I/P |
|---|---|---|---|---|---|---|
| Package | DIP-18 | DIP-18 (same) | DIP-18 (same) | DIP-18 (same) | DIP-18 (same) | DIP-18 (same) |
| Brand | Microchip Technology | Microchip Technology (same) | Microchip Technology (same) | Microchip Technology (same) | Microchip Technology (same) | Microchip Technology (same) |
| Program Flash | 3.5 KB | 3.5 KB (same) | 3.5 KB (same) | 1.75 KB | 1.75 KB | 7.2 KB |
| RAM | 224 bytes | 224 bytes (same) | 224 bytes (same) | 128 bytes | 68 bytes | 256 bytes |
| EEPROM | 128 bytes | 128 bytes (same) | 128 bytes (same) | 128 bytes (same) | 64 bytes | 256 bytes |
| Max Oscillator Frequency | 4 MHz | 4 MHz (same) | 20 MHz | 4 MHz (same) | 4 MHz (same) | 20 MHz |
| Operating Temperature | 0C to +70C (commercial) | -40C to +85C (industrial) | -40C to +85C (industrial) | 0C to +70C (commercial) | 0C to +70C (commercial) | -40C to +85C (industrial) |
| USART | 1 enhanced USART | 1 enhanced USART (same) | 1 enhanced USART (same) | 1 enhanced USART (same) | None | 1 enhanced USART (same) |
| Internal Oscillator | 4 MHz internal RC | 4 MHz internal RC (same) | 4 MHz internal RC | 4 MHz internal RC (same) | None (external only) | 4 MHz internal RC |
| Price Tier (qty 1) | $3.84 | $3.90 (est.) | $3.50 (est.) | $3.20 (est.) | $3.00 (est.) | $4.10 (est.) |
Key Differentiators
- Industrial temperature range option with identical silicon (vs PIC16F628-04I/P)
- 20 MHz oscillator ceiling and nanowatt Sleep modes (vs PIC16F628A-I/P)
- 2x larger Flash for future code growth (vs PIC16F648A-I/P)
Design Notes
Never pull the MCLR pin (pin 4) directly to VDD without a series resistor (typically 10 kohm). The MCLR/VPP pin doubles as the programming voltage input, and ICSP programmers drive this pin to ~13 V during erase/program. Always include the ICSP connector footprint on your PCB even if you program the part in a ZIF socket; field firmware updates without ICSP require desoldering the MCU. The RB6/ICSPCLK and RB7/ICSPDAT pins must be left in their default state during programming, so avoid tying them directly to VDD or VSS with low-impedance paths.
Place the 100 nF decoupling capacitor on VDD (pin 14) within 5 mm of the package, using a short, wide trace. For designs using the internal 4 MHz oscillator, an additional 10 uF bulk capacitor is recommended on the VDD rail. When using an external crystal or resonator, keep the trace between OSC1/OSC2 and the load capacitors under 10 mm and surround the oscillator circuit with a grounded copper pour to keep stray capacitance stable across temperature. For battery-powered designs, add a 100 kohm pull-up on MCLR so the device exits reset cleanly on power-up.
The USART pins RB1/RX and RB2/TX (pins 7 and 8) are shared with synchronous data/clock functions and are not 5V-tolerant when the MCU runs above 5.5 V. When interfacing the PIC16F628-04/P to RS-232 transceivers like the MAX232, ensure the MAX232 VCC matches the MCU VDD (typically 5 V). For RS-485 applications, add a 120 ohm termination resistor only at the cable ends, not at every node, and bias the A/B lines with a 680 ohm pull-up/pull-down divider to keep the line in a defined idle state. Long-distance runs (>1 m) should use shielded twisted pair with the shield grounded at one end only.
The PIC16F628-04/P draws approximately 2 mA at 4 MHz and 5 V with all peripherals active, dropping to < 1 uA in Sleep mode. Estimated: at 4.5 V VDD and 4 MHz oscillator, with USART enabled and Timer1 active, supply current is roughly 2.5 mA; disabling unused peripherals via the PCON register can reduce this by 30-50%. Brown-out Reset (BOR) should be enabled in the configuration word to prevent code corruption during slow VDD rise times; the BOR threshold is typically 4.5 V, which is appropriate for 5 V designs but may need to be lowered for 3.3 V battery operation.
Compliance Information
RoHS-compliant lead-free per DigiKey listing 362645. Not AEC-Q100 qualified - use AEC-Q100 PIC variants for automotive production. Microchip's standard conflict-minerals disclosure applies.