PIC18LF2331-I/SP - 8-bit MCU, 8KB Flash, 40MHz, 28-SPDIP | Microchip
MPN: PIC18LF2331-I/SP ✓ Active| Qty | Unit Price | Extended |
|---|---|---|
| 1 | $6.42 | $6.42 |
| 10 | $5.78 | $57.80 |
| 100 | $5.12 | $512.00 |
| 500 | $4.41 | $2,205.00 |
| 1,000 | $3.85 | $3,850.00 |
PIC18LF2331-I/SP Overview
What is a PIC microcontroller? PIC (Peripheral Interface Controller) is a family of 8/16/32-bit RISC microcontrollers by Microchip Technology. In the broader taxonomy, a PIC MCU sits under: microcontroller -> embedded processor -> semiconductor -> integrated circuit. The PIC18 sub-family specifically uses an 8-bit data path with 16-bit instructions and 31-level hardware stack, positioned above PIC16 in the family hierarchy. PIC18LF2331 integrates nanoWatt Technology - dynamic power-saving modes including Sleep, Idle, and a low-power Timer1 oscillator - making it suited for battery- and energy-aware designs.
Key features include 8KB (4K x 16) of self-programmable Flash, 256 bytes of EEPROM, a 10-bit ADC with up to 8 input channels, dual analog comparators, a USART, MSSP (SPI/I2C), and PWM/CCP modules. The 22 digital I/O pins feature high-current sink/source capability. Internal oscillator options and an 8 x 8 hardware multiplier enable fast math execution. Code protection, low-voltage ICSP (in-circuit serial programming) and ICD (in-circuit debugger) support simplify development with PICkit and MPLAB tools.
Typical applications include brushed DC and stepper motor control loops (using CCP/PWM modules), sensor signal conditioning, low-cost industrial controllers, appliance controls, and small-form-factor consumer devices where 28-pin DIP footprint is desired for through-hole assembly or breadboarding. The wide 2V-5.5V operating range also supports both 3.3V and 5V system rails.
When migrating to PIC18LF2331-I/SP, ensure the code is built against the LF datasheet DC characteristics (2V-5.5V) - the non-LF PIC18F2331-I/SP requires 4.2V-5.5V. Use MPLAB X IDE and XC8 compiler for firmware development. The 28-SPDIP footprint is hand-solderable, breadboard-friendly and supports socketed field replacement.
Drop-in alternatives for PIC18LF2331-I/SP — 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 PIC18LF2331-I/SP (same form factor and footprint) — differing in Package, Core Architecture, Timers, ADC, Communication.
Quick Comparison Tool — Select alternative parts for side-by-side comparison:
PIC18F2331-I/SP
✅ Drop-In📋 Reference alternative (not in catalog)
PIC18LF2321-I/SP
✅ Drop-In📋 Reference alternative (not in catalog)
PIC18LF2331-I/SO
✅ Drop-In✓ In Stock
$4.88 / Unit
View Datasheet →PIC18LF2320-I/SP
✅ Drop-In✓ In Stock
$4.78 / Unit
View Datasheet →PIC18LF2221-I/SP
✅ Drop-In✓ In Stock
$2.78 / Unit
View Datasheet →PIC18LF2331-I/SP Maximum Ratings & Electrical Characteristics
| Core Architecture | 8-bit PIC18 (RISC) |
| Program Memory (Flash) | 8 KB (4K x 16) |
| Data RAM | 768 bytes |
| Data EEPROM | 256 bytes |
| Maximum CPU Speed | 40 MHz |
| Supply Voltage (VDD) | 2.0 V to 5.5 V (LF variant) |
| I/O Pins | 22 |
| ADC | 10-bit, up to 8 channels |
| Analog Comparators | 2 |
| PWM / CCP Modules | Yes (Capture/Compare/PWM) |
| USART | 1 |
| MSSP (SPI / I2C) | 1 |
| Timers | Timer0, Timer1, Timer2, Timer3 |
| Hardware Multiplier | 8 x 8 |
| Package | 28-SPDIP (Skinny Plastic DIP, 0.300 in) |
| Operating Temperature | -40 C to +85 C (Industrial) |
| Mounting Type | Through-Hole |
| Lead-Free / RoHS | Compliant (lead-free finish) |
| Programming / Debug | ICSP + ICD (MPLAB / PICkit compatible) |
| Technology | nanoWatt Technology (low-power modes) |
PIC18LF2331-I/SP Pin Configuration
| Pin 1 | MCLR/RA5 — Master Clear (reset) input or digital I/O RA5 |
| Pin 2 | RA0/AN0 — Digital I/O RA0 / analog input AN0 |
| Pin 3 | RA1/AN1 — Digital I/O RA1 / analog input AN1 |
| Pin 4 | RA2/AN2 — Digital I/O RA2 / analog input AN2 |
| Pin 5 | RA3/AN3/VREF+ — Digital I/O RA3 / analog input AN3 / VREF+ |
| Pin 6 | RA4/AN4 — Digital I/O RA4 / analog input AN4 |
| Pin 7 | AVDD — Analog supply voltage |
| Pin 8 | AVSS — Analog ground |
| Pin 9 | OSC1/RA7 — Crystal oscillator input / digital I/O RA7 |
| Pin 10 | OSC2/RA6 — Crystal oscillator output / digital I/O RA6 |
| Pin 11 | RC0/T1OSO/T1CKI — Digital I/O RC0 / Timer1 oscillator output / clock input |
| Pin 12 | RC1/T1OSI — Digital I/O RC1 / Timer1 oscillator input |
| Pin 13 | RC2/CCP1 — Digital I/O RC2 / Capture/Compare/PWM channel 1 |
| Pin 14 | RC3 — Digital I/O RC3 |
| Pin 15 | RC4 — Digital I/O RC4 |
| Pin 16 | RC5 — Digital I/O RC5 |
| Pin 17 | RC6/TX/CK — Digital I/O RC6 / USART TX or clock |
| Pin 18 | RC7/RX/DT — Digital I/O RC7 / USART RX or data |
| Pin 19 | VSS — Digital ground |
| Pin 20 | VDD — Digital supply voltage |
| Pin 21 | RB0/INT0 — Digital I/O RB0 / external interrupt 0 |
| Pin 22 | RB1/INT1 — Digital I/O RB1 / external interrupt 1 |
| Pin 23 | RB2 — Digital I/O RB2 |
| Pin 24 | RB3 — Digital I/O RB3 |
| Pin 25 | RB4 — Digital I/O RB4 |
| Pin 26 | RB5 — Digital I/O RB5 |
| Pin 27 | RB6/PGC — Digital I/O RB6 / ICSP clock |
| Pin 28 | RB7/PGD — Digital I/O RB7 / ICSP data |
Typical Applications
PIC18LF2331-I/SP is suitable for 6 applications: Brushed DC Motor Control, Stepper Motor Sequencing, Sensor Signal Conditioning Node, Appliance Control Board, Low-Cost Industrial Controller, Consumer Electronics Embedded Controller.
Brushed DC Motor Control
The PIC18LF2331-I/SP fits brushed DC motor control loops because its CCP/PWM modules, dual analog comparators, and 10-bit ADC are purpose-built for closed-loop speed and current regulation. The 40 MHz PIC18 core delivers instruction-cycle PWM updates fast enough for 20 kHz switching, while the 2.0V-5.5V supply range lets the MCU share a 3.3V rail with the gate driver and Hall-effect sensor. With 22 I/O pins, designers wire H-bridge direction signals, fault inputs, tachometer feedback, and a UART debug port without an I/O expander. nanoWatt Sleep modes cut average current below 1 uA when the motor is idle, a meaningful win for battery-powered tools and robotics.
Recommended
Stepper Motor Sequencing
Stepper motor sequencer firmware benefits from PIC18LF2331-I/SP's hardware CCP/PWM channels that can generate precise step pulses and direction logic without CPU overhead. The 768 bytes of RAM hold microstep tables, while 8KB Flash stores profile lookups and end-stop debounce logic. Industrial -40C to +85C temperature rating supports outdoor, factory, and cabinet installations. The 28-SPDIP through-hole footprint remains popular for CNC retrofit and 3D-printer controller boards where hand-soldering and socketed field replacement simplify maintenance. PICkit ICD debugging ports speed firmware iteration.
Recommended
Sensor Signal Conditioning Node
Sensor-interface nodes use PIC18LF2331-I/SP's 10-bit ADC, dual comparators, and 22 I/O to multiplex analog and digital sensors onto a single chip. The wide 2.0V-5.5V supply lets the MCU run from a 3.3V coin-cell or a regulated 5V rail, and nanoWatt Sleep lowers quiescent current to below 1 uA, ideal for battery-monitored thermostats, gas detectors, and HVAC peripherals. MSSP supports I2C/SPI sensor buses, and USART bridges to RS-485 transceivers for industrial sensor networks. Industrial temperature grade makes it suitable for outdoor enclosures and factory-floor modules.
Recommended
Appliance Control Board
White-goods and appliance control boards rely on PIC18LF2331-I/SP for its blend of PWM (for valve/relay drivers), 10-bit ADC (for temperature/pressure feedback), and robust -40C to +85C industrial temperature range. The 8KB Flash holds application code and lookup tables for wash cycles, while the 256-byte EEPROM stores user settings and fault logs that survive power cycles. 22 I/O accommodate user-interface buttons, LED indicators, and triac-controlled outputs. Through-hole SPDIP eases conformal-coating rework lines, and ICSP allows end-of-line firmware customization.
Recommended
Low-Cost Industrial Controller
PIC18LF2331-I/SP fits cost-sensitive industrial controllers that need 22 GPIO, 8KB Flash, and 40 MHz throughput without the BOM cost of a 32-bit ARM core. The USART plus MSSP support RS-232/RS-485, I2C, and SPI fieldbus peripherals, while 10-bit ADC scans 4-20 mA process inputs through external sense resistors. -40C to +85C industrial rating covers factory floors, and the 28-SPDIP socketed footprint simplifies field replacement. MPLAB X IDE with XC8 compiler and PICkit programmers create a low-cost development chain for OEM vendors.
Recommended
Consumer Electronics Embedded Controller
PIC18LF2331-I/SP powers embedded controllers in mid-tier consumer devices such as toys, educational kits, coffee makers, and small appliances where its 8KB Flash, 22 I/O, and USART/MSSP peripherals deliver enough capability without the price of an ARM Cortex-M0. The 2.0V-5.5V supply supports both 3.3V Li-ion and 5V USB-powered designs, and nanoWatt Sleep modes extend battery life for wireless remote controllers. Through-hole SPDIP is popular for hobby and educational markets because it fits 0.1 inch pitch breadboards and is hand-solderable.
Recommended
Recommended Products Summary
Engineering reference data for PIC18LF2331-I/SP — comparison, design guidance, and compliance information.
Selection Guide
Comparison with Alternatives
| Parameter | This Product | PIC18F2331-I/SP | PIC18LF2321-I/SP | PIC18LF2331-I/SO | PIC18LF2320-I/SP | PIC18LF2221-I/SP |
|---|---|---|---|---|---|---|
| Brand | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology |
| Package | 28-SPDIP | 28-SPDIP - same | 28-SPDIP - same | 28-SOIC - surface-mount variant | 28-SPDIP - same | 28-SPDIP - same |
| Program Memory (Flash) | 8 KB | 8 KB | 8 KB | 8 KB | 4 KB (-50%) | 2 KB (-75%) |
| Data RAM | 768 bytes | 768 bytes | 768 bytes | 768 bytes | 512 bytes (-33%) | 256 bytes (-67%) |
| Supply Voltage | 2.0 V to 5.5 V | 4.2 V to 5.5 V | 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 5.5 V |
| Maximum CPU Speed | 40 MHz | 40 MHz | 40 MHz | 40 MHz | 40 MHz | 40 MHz |
| I/O Pins | 22 | 22 | 16 (-6) | 22 | 16 (-6) | 16 (-6) |
| ADC | 10-bit, 8 ch | 10-bit, 8 ch | 10-bit, 5 ch | 10-bit, 8 ch | 10-bit, 5 ch | 10-bit, 5 ch |
| Operating Temperature | -40 C to +85 C (Industrial) | -40 C to +85 C (Industrial) | -40 C to +85 C (Industrial) | -40 C to +85 C (Industrial) | -40 C to +85 C (Industrial) | -40 C to +85 C (Industrial) |
| Approximate Unit Price (as of 2026-09-28) | $6.42 | Similar | Lower (less Flash/IO) | Similar (SOIC variant) | Lower | Lowest |
Key Differentiators
- Lower operating voltage for battery-direct designs (vs PIC18F2331-I/SP)
- Highest I/O count in 28-SPDIP LF family (vs PIC18LF2321-I/SP)
- Through-hole industrial temperature grade (vs PIC18LF2331-I/SO)
- More Flash than lower-tier siblings (vs PIC18LF2320-I/SP / PIC18LF2221-I/SP)
Design Notes
Estimated: at 40 MHz, VDD=3.3V, and typical CMOS I/O load of 10 mA, average IDD is around 12-16 mA. Add 0.1 uF ceramic decoupling on each VDD/AVDD pin, placed within 5 mm of the package lead. A bulk 10 uF tantalum or ceramic near the MCU stabilizes the rail during ADC conversions. For battery-powered designs, route MCLR through a 10 kohm pull-up to VDD and a 100 nF cap to ground for clean power-on reset; do not leave MCLR floating.
At 40 MHz with all peripherals enabled, the PIC18LF2331-I/SP dissipates well under 100 mW; the 28-SPDIP plastic package is rated for -40C to +85C industrial operation. No heatsink is required. For sealed enclosures, ensure ambient inside the box stays below 70C with derating, and place thermal vias under the SPDIP leads to spread heat into the PCB copper.
Keep the 28-SPDIP footprint on a 0.300 inch row spacing with standard 0.1 inch pitch headers so the part fits breadboards and standard IC sockets. Route the analog AVSS/AVDD pins with a star-ground topology and keep analog traces short and away from PWM/CCP digital outputs. Reserve the ICSP pins (RB6/RB7) with a 2x3 or 1x5 0.1 inch header footprint for PICkit programming even on production boards to simplify field updates.
Estimated: do not connect AVDD/AVSS to noisy digital rails without decoupling - the 10-bit ADC accuracy degrades with shared ground bounce. Configure unused I/O pins as outputs (not inputs) to avoid floating-pin shoot-through current. Always set the LF configuration bits correctly in your C source - the PIC18F2331 and PIC18LF2331 share the same bit names but the LF variant requires the LVP (low-voltage programming) bit to match your in-circuit programmer's voltage level. Verify the part number on the top marking before firmware upload because PIC18F2331 firmware can run on PIC18LF2331 below 4.2V but Flash programming will fail outside VDD spec.
Place the decoupling capacitors on the same side of the PCB as the MCU, with short, wide traces to VDD/VSS. For the 28-SPDIP, a 4-layer board with continuous ground plane beneath the part provides the best EMI/EMC performance; on 2-layer boards, flood the top and bottom copper around the MCU and stitch with vias. Keep crystal traces short and symmetric, and guard the analog pins with a grounded analog ground ring if you are using ADC channels.
Compliance Information
Lead-free SPDIP package per Microchip product page. Industrial temperature grade -40C to +85C. Not AEC-Q100 qualified; this is a general-purpose MCU not targeted at automotive.