PIC18F2221-E/ML - 8-Bit 25MHz 4KB Flash MCU 28-QFN | Microchip
MPN: PIC18F2221-E/ML ✓ Active| Qty | Unit Price | Extended |
|---|---|---|
| 1 | $5.22 | $5.22 |
| 10 | $4.68 | $46.80 |
| 100 | $3.95 | $395.00 |
| 500 | $3.42 | $1,710.00 |
| 1,000 | $2.98 | $2,980.00 |
PIC18F2221-E/ML Overview
An 8-bit microcontroller (MCU) is a programmable computing-on-a-chip that executes instructions on 8-bit data words. It belongs to the broader category of microcontrollers, which are single-chip systems integrating CPU, memory, and peripherals. The PIC18F2221 sits within Microchip's PIC18 family, which extends the PIC16 baseline architecture with linear addressing, C-friendly memory organization, and enhanced peripherals. Within the product hierarchy, an 8-bit MCU is the simplest class of programmable logic, sitting below 16-bit (MSP430, PIC24) and 32-bit (Cortex-M) controllers.
Key specifications include a 25 MHz maximum clock (40 MHz oscillator input via PLL), 16-bit instructions, 77 single-word instruction set, hardware multiply, nanoWatt power management for low-power sleep modes, an internal oscillator, and an enhanced USART, I2C, and SPI serial interface. The PIC18F2221 operates across 2.0V to 5.5V, with the E suffix denoting the extended -40C to +125C industrial temperature grade. The 28-QFN package provides a low-profile 6x6 mm footprint with an exposed pad for thermal dissipation.
The PIC18F2221 is built on Microchip's enhanced Harvard architecture with separate program and data buses, supporting pipelined fetch/decode and a 16-bit instruction word optimized for compiled C code. It features 10-bit PWM modules, a programmable 16-level hardware stack, and self-programming Flash with ICSP (In-Circuit Serial Programming). The nanoWatt technology delivers idle currents below 1 uA in sleep modes, making it well-suited for battery-powered applications.
Typical applications include industrial sensor nodes, white goods control, low-cost motor control, USB-to-UART bridges, LED lighting controllers, and automotive body modules. It is also widely used in educational and hobbyist platforms such as PICkit 3 starter kits due to its low price and mature toolchain (MPLAB X IDE + XC8 compiler).
When designing with the PIC18F2221-E/ML, ensure the exposed pad is soldered to the PCB ground plane for thermal performance and electrical reference. Use MPLAB X IDE with the free XC8 compiler and select the PIC18F2221 device for full peripheral library support. For applications above 40 MHz or requiring DSP capability, evaluate the dsPIC33 or PIC24 families instead.
Drop-in alternatives for PIC18F2221-E/ML — 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 PIC18F2221-E/ML (same form factor and footprint) — differing in ADC, Operating Temperature, Package, I/O Pins, Maximum CPU Speed.
Quick Comparison Tool — Select alternative parts for side-by-side comparison:
PIC18F2321-E/ML
✅ Drop-In✓ In Stock
$3.55 / Unit
View Datasheet →PIC18F4221-E/ML
✅ Drop-In✓ In Stock
$2.84 / Unit
View Datasheet →PIC18LF2221-I/ML
✅ Drop-In📋 Reference alternative (not in catalog)
PIC18F2221-I/ML
✅ Drop-In📋 Reference alternative (not in catalog)
PIC18F2221T-I/ML
✅ Drop-In✓ In Stock
$2.62 / Unit
View Datasheet →PIC18F2221-E/ML Maximum Ratings & Electrical Characteristics
| Core Architecture | PIC18 (8-bit) |
| Program Memory (Flash) | 4 KB (2K x 16) |
| RAM | 512 bytes |
| EEPROM | 256 bytes |
| Maximum CPU Speed | 25 MHz (10 MIPS) |
| Instruction Set | 77 single-word instructions, 16-bit opcode |
| Digital I/O Pins | 25 |
| ADC | 10-bit, up to 10 input channels |
| PWM Modules | 10-bit PWM (peripheral) |
| Supply Voltage | 2.0 V to 5.5 V |
| Operating Temperature | -40 C to +125 C (E suffix) |
| Package | 28-pin QFN (6x6 mm) with exposed pad (ML) |
| Mounting Type | Surface Mount |
| RoHS Status | Compliant |
| Lead-Free | Yes |
| ICSP | Yes (In-Circuit Serial Programming) |
| Self-Programming | Yes (Flash) |
PIC18F2221-E/ML Pin Configuration
| Pin 1 | RA2/AN2 — Digital I/O / Analog input channel 2 |
| Pin 2 | RA3/AN3/VREF+ — Digital I/O / Analog input 3 / ADC positive reference |
| Pin 3 | RA4/AN4 — Digital I/O / Analog input 4 |
| Pin 4 | RA5/AN5/SS/HLVDIN — Digital I/O / Analog input 5 / SPI Slave Select / High/Low Voltage Detect input |
| Pin 5 | RA6/OSC2/CLKO — Digital I/O / Oscillator output / Clock output |
| Pin 6 | RA7/OSC1/CLKI — Digital I/O / Oscillator input / Clock input |
| Pin 7 | VSS — Ground reference |
| Pin 8 | VDD — Positive supply voltage (2.0-5.5 V) |
| Pin 9 | RB0/INT0/AN12 — Digital I/O / External interrupt 0 / Analog input 12 |
| Pin 10 | RB1/INT1/AN10 — Digital I/O / External interrupt 1 / Analog input 10 |
| Pin 11 | RB2/INT2/AN8 — Digital I/O / External interrupt 2 / Analog input 8 |
| Pin 12 | RB3/AN9/CCP2 — Digital I/O / Analog input 9 / Capture/Compare/PWM 2 |
| Pin 13 | RB4/AN11 — Digital I/O / Analog input 11 |
| Pin 14 | RB5/CCP1 — Digital I/O / Capture/Compare/PWM 1 |
| Pin 15 | RB6/PGC — Digital I/O / ICSP clock (programming) |
| Pin 16 | RB7/PGD — Digital I/O / ICSP data (programming) |
| Pin 17 | RC0/T1OSO/T1CKI — Digital I/O / Timer1 oscillator output / Timer1 clock input |
| Pin 18 | RC1/T1OSI/CCP2 — Digital I/O / Timer1 oscillator input / CCP2 |
| Pin 19 | RC2/CCP1 — Digital I/O / Capture/Compare/PWM 1 |
| Pin 20 | RC3/SCK/SCL — Digital I/O / SPI clock / I2C clock |
| Pin 21 | RC4/SDI/SDA — Digital I/O / SPI data in / I2C data |
| Pin 22 | RC5/SDO — Digital I/O / SPI data out |
| Pin 23 | RC6/TX/CK — Digital I/O / USART asynchronous transmit / USART synchronous clock |
| Pin 24 | RC7/RX/DT — Digital I/O / USART asynchronous receive / USART synchronous data |
| Pin 25 | RD0 — Digital I/O (Port D bit 0) |
| Pin 26 | RD1 — Digital I/O (Port D bit 1) |
| Pin 27 | RD2 — Digital I/O (Port D bit 2) |
| Pin 28 | RD3 — Digital I/O (Port D bit 3) |
Typical Applications
PIC18F2221-E/ML is suitable for 7 applications: Industrial Sensor Node, White Goods Control Board, LED Lighting Controller, Automotive Body Module, USB-to-UART Bridge Dongle, Educational / Hobbyist Platform, Low-Cost Motor Control (BLDC / Stepper).
Industrial Sensor Node
The PIC18F2221-E/ML is well-suited for industrial sensor nodes because of its extended -40 C to +125 C temperature range and nanoWatt low-power sleep modes drawing under 1 uA. The 10-bit ADC with up to 10 input channels reads thermocouple, RTD, or 4-20 mA sensor signals directly. The 25 MHz core executes sensor linearization algorithms while the 4 KB Flash accommodates the full state machine plus UART/I2C/SPI outputs to a host PLC.
Recommended
White Goods Control Board
Washing machines, dishwashers, and ovens use the PIC18F2221-E/ML for motor and heater control. The PIC18F2221's 25 MHz CPU cycles through control loops while the 10-bit PWM modules drive TRIAC phase-angle control for heater elements. The 25 I/O pins scan keypads and drive seven-segment displays. The exposed thermal pad of the 28-QFN package dissipates heat from the 25 MHz core running continuously at 5 V.
Recommended
LED Lighting Controller
Addressable RGB LED strips and architectural lighting fixtures use the PIC18F2221-E/ML for color-mixing control. The 25 MHz core runs WS2812 / APA102 protocols with bit-banging or hardware SPI, while the 10-bit PWM outputs dim analog LED drivers. The nanoWatt sleep modes extend battery life in portable LED lanterns below 1 uA standby current, and the 4 KB Flash stores lighting scenes.
Recommended
Automotive Body Module
The PIC18F2221-E/ML's extended -40 C to +125 C temperature range suits under-hood automotive body modules such as window lift controllers, seat position memories, and mirror adjusters. The 25 I/O pins scan switches and drive H-bridge MOSFETs via the TC4427 driver. The 512-byte RAM handles LIN bus message buffering, and the 4 KB Flash fits the J1939 / LIN protocol stack with diagnostic services.
Recommended
USB-to-UART Bridge Dongle
The PIC18F2221-E/ML can implement a low-cost USB CDC bridge by combining it with the MCP2221A USB-to-UART IC, or by directly utilizing the PIC18F USB variants. The 25 MHz core handles serial-to-parallel conversion at up to 921600 baud while the 512-byte RAM buffers packets. The 28-QFN package fits inside a USB Type-A dongle housing, and the 4 KB Flash stores the CDC ACM driver.
Recommended
Educational / Hobbyist Platform
The PIC18F2221-E/ML is widely used in education because of its $2-3 unit price, MPLAB X IDE support, free XC8 C compiler, and PICkit 3 / PICkit 4 programmer compatibility. The 4 KB Flash, 512-byte RAM, and 25 I/O pins provide enough headroom for teaching embedded C, interrupts, ADC sampling, and PWM servo control. The 28-QFN package also fits the standard through-hole 28-pin DIP breakout board for breadboarding.
Recommended
Low-Cost Motor Control (BLDC / Stepper)
Small BLDC fans, stepper motors in 3D printers, and robotic actuators use the PIC18F2221-E/ML for closed-loop commutation. The 25 MIPS performance runs the Field-Oriented Control (FOC) or trapezoidal commutation loop while the 10-bit PWM outputs drive the gate driver ICs. The 25 I/O pins read Hall sensors or quadrature encoders, and the 4 KB Flash stores the lookup-table-based sine commutation profile.
Recommended
Recommended Products Summary
Engineering reference data for PIC18F2221-E/ML — comparison, design guidance, and compliance information.
Selection Guide
Comparison with Alternatives
| Parameter | This Product | PIC18F2321-E/ML | PIC18F4221-E/ML | PIC18LF2221-I/ML | PIC18F2221-I/ML |
|---|---|---|---|---|---|
| Package | 28-QFN (6x6 mm) | 28-QFN (6x6 mm) - same | 28-QFN (6x6 mm) - same | 28-QFN (6x6 mm) - same | 28-QFN (6x6 mm) - same |
| Brand | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology |
| Program Memory (Flash) | 4 KB | 8 KB | 4 KB | 4 KB | 4 KB |
| RAM | 512 bytes | 512 bytes | 512 bytes | 512 bytes | 512 bytes |
| Max CPU Speed | 25 MHz (10 MIPS) | 25 MHz (10 MIPS) | 25 MHz (10 MIPS) | 25 MHz (10 MIPS) | 25 MHz (10 MIPS) |
| Operating Voltage | 2.0 V to 5.5 V | 2.0 V to 5.5 V | 2.0 V to 5.5 V | 2.0 V to 3.6 V | 2.0 V to 5.5 V |
| Temperature Range | -40 C to +125 C (Extended) | -40 C to +125 C (Extended) | -40 C to +125 C (Extended) | -40 C to +85 C (Industrial) | -40 C to +85 C (Industrial) |
| Digital I/O | 25 | 25 | 36 | 25 | 25 |
Key Differentiators
- Extended -40/+125 C industrial temperature grade (vs PIC18F2221-I/ML)
- Cost-optimized 4 KB Flash for high-volume embedded products (vs PIC18F2321-E/ML)
- Mature MPLAB X IDE + XC8 compiler ecosystem (vs Cross-brand 8-bit MCU (e.g., ATmega328P-AU))
Design Notes
Solder the central exposed thermal pad of the 28-QFN package to a continuous ground plane via thermal vias (recommended 4-9 vias, 0.3 mm drill, 0.5 mm pitch). This both dissipates the 25 MHz core heat and provides the electrical ground reference for the PLL. Missing the thermal pad connection can cause +15 C junction temperature rise and unstable oscillator behavior above 5.0 V VDD.
Place a 100 nF ceramic decoupling capacitor within 5 mm of the VDD pin (pin 8) and a 10 uF bulk capacitor at the board-level power entry. For nanoWatt sleep mode applications, add a 100 kohm pull-up on MCLR to prevent floating reset during sleep. The PIC18F2221 datasheet section 2 recommends using two decoupling capacitors to handle both digital switching transients and analog ADC reference stability.
Do not omit the configuration bits (CONFIG1H through CONFIG2L) - the PIC18F2221 will not execute code without them properly set. Use MPLAB X IDE's Configuration Bits window or #pragma config directives in XC8 to set the oscillator mode (HS vs internal RC), watchdog timer, low-voltage programming, and code protection. Also note that RB6/RB7 are shared with ICSP programming; isolate any high-current loads on these pins during in-circuit programming to avoid programming failures.
Route the oscillator traces (OSC1/OSC2, pins 6-7) as short as possible with ground guard traces. Keep the analog inputs (AN0-AN12) physically separated from digital switching signals to avoid ADC noise coupling. The 10-bit ADC achieves +/-1 LSB accuracy only when the analog traces are guarded and the AVSS pin (when present) shares a clean ground return. For crystal operation above 20 MHz, use a fundamental-mode crystal with 20 pF load capacitors matched to the crystal's CL spec.
Compliance Information
RoHS and REACH compliant per Microchip product page. Industrial-grade (-40/+125 C) but not AEC-Q100 qualified for automotive safety - use dsPIC33 or PIC32 for AEC-Q100 designs.