PIC18F4550 Pinout, Datasheet & Pin Configuration (DIP-40)

In this guide, you’ll find the PIC18F4550 pinout (pin diagram) for the DIP-40 package, the full pin configuration table (with TQFP-44 and QFN-44 pin numbers), its datasheet, a minimal circuit, and every pin group explained with its reset state and gotchas. Without further ado, let’s get right into it!

The PIC18F4550 is Microchip’s classic USB microcontroller: an 8-bit PIC18 core running up to 48MHz (12 MIPS) with 32KB Flash, 2KB RAM, 256 bytes of EEPROM, and a full-speed USB 2.0 device module with its own transceiver and 3.3v regulator. In the breadboard-friendly PDIP-40 package (PIC18F4550-I/P), it gives you 34 I/O pins, 13 ADC channels, and 2 CCP modules (one of them an enhanced ECCP).


PIC18F4550 Pinout Diagram

Here is a detailed PIC18F4550 Pinout Diagram with colored labels and legends to help you easily identify the functionalities that each pin can perform. It shows the DIP-40 package from the top, with pin 1 next to the notch and the dot.

PIC18F4550 pinout diagram (pin configuration) for the DIP-40 package with port, ADC, PWM, UART, SPI, I2C and USB pin functions
PIC18F4550-I/P, PDIP-40 (top view)

Each row shows the physical pin number, the port bit (RA0, RB5…), and its functions sorted into columns: control and programming, analog, timer/CCP, EUSART, SPI, I2C, USB, and other. The colored tabs inside the chip tell you which port each pin belongs to, the arrows mark the input-only pins (RE3, RC4, and RC5), and the numbered badges point to the notes at the bottom. The same pin diagram also fits the PIC18F4455 and the low-voltage PIC18LF4550.

Buy a PIC18F4550: If you don’t have one yet, you can get the PIC18F4550-I/P DIP-40 chip from Amazon or AliExpress. The DIP package plugs straight into a breadboard, so you can build the minimal circuit below in a few minutes.

Download PIC18F4550 Pinout Diagram (Full Resolution)

The PIC18F4550 DIP-40 pinout diagram in full resolution (5120×3338 px WebP), in one ZIP file. Print it, zoom in, or keep it next to your bench. Please consider supporting my work if it helped you.


PIC18F4550 Datasheet

The PIC18F4550 shares one datasheet with the PIC18F2455, PIC18F2550, and PIC18F4455. Here are the official PIC18F4550 datasheet and errata documents you’ll need, all linked to Microchip’s own servers:

DocumentIDRevisionWhat you’ll use it forLink
PIC18F2455/2550/4455/4550 Data SheetDS39632Rev E (2009)Pin descriptions (Table 1-3), oscillator and USB clock tables, configuration bits, electrical limitsPDF
PIC18F2455/2550/4455/4550 Family Silicon Errata and Data Sheet ClarificationDS80478Rev A (2009)Silicon bugs and datasheet corrections, including the USB regulator default (VREGEN)PDF
Timer1 Module Data Sheet ErrataDS80329Rev B (2010)The Timer1 oscillator and counter issuesPDF

Which document do I need? The datasheet for pin functions, the USB clock setup, and the configuration bits, and the DS80478 errata before you design the USB power path. All of them are listed on the official PIC18F4550 product page, where Microchip shows the PIC18F4550 as In Production and lists the PIC18F45K50 as the newer device. Revision E is still the latest datasheet.

Note: The DS80478 errata corrects the datasheet on the USB regulator: VREGEN is disabled by default (the datasheet text says enabled), so set VREGEN = ON in your configuration bits. It also states that VDD must stay at or above VUSB at all times.


PIC18F4550 Minimal Circuit

A bare PIC18F4550 needs only a handful of parts to run your code and enumerate on USB: 2 decoupling capacitors, a crystal with 2 load capacitors, a pull-up on MCLR, a capacitor on VUSB, the 6-pin ICSP header for your programmer, and a USB connector. Here is the PIC18F4550 circuit diagram I recommend for a breadboard or a first PCB.

PIC18F4550 circuit diagram: minimal circuit with 20MHz crystal, decoupling capacitors, MCLR pull-up, VUSB capacitor, ICSP header and USB connector

PartPIC18F4550 pinsValueWhy
Decoupling capacitor11 (VDD) – 12 (VSS)100nF ceramicKeeps the supply clean; place it right at the pins
Decoupling capacitor32 (VDD) – 31 (VSS)100nF ceramicThe second supply pair must be wired and decoupled too
Crystal13 (OSC1) – 14 (OSC2)20MHz (HS)With the PLL, gives 48MHz for the CPU and the USB module
Load capacitors13 and 14 to VSS15pF each (DS39632E Table 2-2; 22pF also works)Start the crystal reliably
MCLR pull-up1 (MCLR) to VDD10kΩA floating MCLR resets the chip at random
Reset button1 (MCLR) to VSSPush buttonOptional manual reset
VUSB capacitor18 (VUSB) to VSS470nF ceramic (220nF min)Stabilizes the internal 3.3v USB regulator
ICSP header1, 11, 12, 40, 39, 386-pin, 2.54mmConnects a PICkit or MPLAB SNAP
USB connector23 (D−), 24 (D+), VBUS, GNDUSB-B or Micro-BPowers the chip (5v) and carries USB data
  • Power: run the chip from 5v (USB VBUS or a regulated supply). The PIC18F4550 needs at least 4.2v for 48MHz operation, and both VDD/VSS pairs (11/12 and 32/31) must be connected.
  • Clock: the 20MHz crystal is the most common choice because the PLL divider (PLLDIV = 5) turns it into the 4MHz the 96MHz USB PLL needs. Any crystal from 4MHz to 24MHz that divides down to 4MHz works too.
  • MCLR: a series 100Ω–470Ω resistor or a diode between the pull-up node and a reset capacitor protects your programmer’s VPP voltage. Without a capacitor on MCLR, the plain 10kΩ pull-up is enough.
  • Configuration bits: this circuit needs FOSC = HSPLL_HS, PLLDIV = 5, CPUDIV = OSC1_PLL2, USBDIV = 2, VREGEN = ON, LVP = OFF, and PBADEN = OFF. The full block is in the Getting Started section below.

PIC18F4550 Specs

Here are the PIC18F4550 specifications for the DIP-40 package, taken from the DS39632E datasheet.

ItemPIC18F4550
Core8-bit PIC18, 4 clocks per instruction, up to 48MHz (12 MIPS)
Program memory32KB Flash (16,384 single-word instructions), 100,000 erase/write cycles (typical)
Data memory2KB SRAM (1KB of it shared with the USB buffers), 256 bytes EEPROM
Supply voltage4.2v–5.5v for 48MHz (PIC18LF4550: 2.0v–5.5v)
I/O34 port pins (PORTA–PORTE), including RA6 on OSC2 and the input-only RE3 on MCLR (the device table in the datasheet counts 35 I/O)
Current limits25mA per I/O pin (sink or source), 200mA total for all ports, 250mA into VDD, 300mA out of VSS
USBFull-speed USB 2.0 device (12Mbps), on-chip transceiver and 3.3v regulator, up to 32 endpoints (16 bidirectional)
ADC13 channels, 10-bit, external VREF+/VREF− option
TimersTimer0 (8/16-bit), Timer1 and Timer3 (16-bit), Timer2 (8-bit)
CCP / PWMCCP1 as an enhanced ECCP (P1A–P1D, half and full bridge), CCP2 standard
Serial1x EUSART, 1x MSSP (SPI or I2C), 8-bit Streaming Parallel Port (SPP)
Analog extras2 comparators, comparator voltage reference, high/low-voltage detect (HLVD)
OscillatorCrystal or resonator up to 25MHz (24MHz with the USB PLL), external clock up to 48MHz, internal 8MHz INTOSC and 31kHz INTRC
ProgrammingICSP over PGC/PGD (pins 39/40), high-voltage on MCLR/VPP or low-voltage with PGM (pin 38)
PackagesPDIP-40 (-I/P), TQFP-44 (-I/PT), QFN-44 (-I/ML)

Get a PIC18F4550: The PIC18F4550-I/P (DIP-40) is the one I recommend for breadboards. Grab it from Amazon or AliExpress.

PIC18F4550 Specifications Summary

  • The PIC18F4550 has 40 pins in DIP-40: 34 I/O, 2 VDD, 2 VSS, OSC1, and VUSB.
  • PORTA is RA0–RA6 (RA6 only without a crystal); there is no RA7.
  • PORTC has no RC3, and RC4/RC5 are input-only (they are the USB D−/D+ pins).
  • RE3 shares pin 1 with MCLR and is input-only (needs MCLRE = OFF).
  • 13 ADC channels: AN0–AN4 on PORTA, AN5–AN7 on PORTE, AN8–AN12 on PORTB.
  • PWM: CCP1/P1A on RC2 (plus P1B–P1D on RD5–RD7) and CCP2 on RC1 (or RB3).
  • EUSART: TX on RC6 (pin 25) and RX on RC7 (pin 26).
  • I2C: SDA on RB0 (pin 33) and SCL on RB1 (pin 34); SPI adds SDO on RC7 and SS on RA5.
  • USB: D− on pin 23, D+ on pin 24, and a 220nF–470nF capacitor on VUSB (pin 18).
  • ICSP: MCLR/VPP pin 1, PGM pin 38, PGC pin 39, PGD pin 40.
  • At reset, RA0–RA3, RA5, RE0–RE2, and RB0–RB4 are analog, and RB5 is the LVP programming pin.
  • 25mA per pin, 200mA for all ports together; 4.2v–5.5v for 48MHz.

PIC18F4550 Quick Pin Selection Guide

Use caseRecommended pinsWhy
Serial (UART)RC6 (TX, pin 25), RC7 (RX, pin 26)The only EUSART
I2CRB0 (SDA, pin 33), RB1 (SCL, pin 34)MSSP in I2C mode; add 4.7kΩ pull-ups
SPI masterRB1 (SCK), RB0 (SDI), RC7 (SDO), any pin as CSMSSP in SPI mode; SDO shares RC7 with UART RX
PWMRC2 (CCP1, pin 17), RC1 (CCP2, pin 16)Hardware PWM from Timer2
Motor H-bridgeRC2/P1A, RD5/P1B, RD6/P1C, RD7/P1DECCP half/full-bridge with dead band
Analog inputRA0–RA3 (AN0–AN3)Analog at reset, no other function in the way
External interruptRB0 (INT0), RB1 (INT1), RB2 (INT2)Edge-triggered interrupts
Button / keypadRB4–RB7 (interrupt-on-change)Internal weak pull-ups on PORTB (RBPU)
USBRC4 (D−, pin 23), RC5 (D+, pin 24)Fixed USB pins, with the cap on VUSB
LEDs and general outputsPORTD (RD0–RD7)Digital at reset and 8 bits in a row
Character LCD (4-bit)PORTDNo analog setup needed

PIC18F4550 Pins to Use With Caution

PinReasonWhat to do
RB5 / PGM (38)LVP is ON by default: a floating or high RB5 puts the chip into programming mode (random resets or freezes)Set LVP = OFF, or pull RB5 low with 10kΩ
RB0–RB4 (33–37)PBADEN = ON by default makes them analog, so they read 0 as digital inputsPBADEN = OFF or ADCON1 = 0x0F
RA0–RA3, RA5, RE0–RE2Analog at resetADCON1 = 0x0F for all-digital
RC4, RC5 (23, 24)Input-only (no TRISC bit), and digital only with the USB module offUse them for USB, or as inputs only
RC3Doesn’t exist on this chipDon’t look for it in TRISC
MCLR / RE3 (1)Resets the chip when low; sees 9v–13.25v during programming10kΩ pull-up; never connect it straight to other circuits
VUSB (18)A regulator output, not a supply input220nF–470nF to ground; never feed 5v into it
OSC1, OSC2 (13, 14)Taken by the crystalLeave them to the crystal
RB6, RB7 (39, 40)PGC/PGD for ICSP and debuggingKeep loads light (no low-value resistors or big capacitors)
RC7 (26)Shared by UART RX and SPI SDOPick one of them for your design

PIC18F4550 Pin Diagram Explained

The 40 pins in the PIC18F4550 pin diagram are divided into the following groups based on the hardware functionality they’re used for:

We’ll discuss each pin group in the following sections one by one in more detail.


PIC18F4550 Power Pins

The PIC18F4550 has 2 VDD pins (11 and 32) and 2 VSS pins (12 and 31), and you must connect all four, each pair with its own 100nF capacitor. Pin 18 (VUSB) is the output of the internal 3.3v USB regulator.

PIC18F4550 power pins (VDD pins 11 and 32, VSS pins 12 and 31, VUSB pin 18, MCLR pin 1)

PinNameFunctionNotes
11, 32VDDPositive supply4.2v–5.5v (2.0v–5.5v on the PIC18LF4550); 250mA max into VDD
12, 31VSSGround300mA max out of VSS
18VUSBUSB transceiver supply (3.3v)Regulator output with VREGEN = ON; 220nF–470nF to ground
1MCLR/VPPReset / programming voltage10kΩ pull-up to VDD

The PIC18F4550 runs at 48MHz from 4.2v to 5.5v. Below 4.2v, you need the PIC18LF4550 and a lower clock. When VDD is below about 4v, the internal regulator can’t make 3.3v for USB, so you turn VREGEN off and feed 3.0v–3.6v into VUSB from an external regulator instead (and VDD must never be lower than VUSB, per the errata).

Note: Wire both VDD/VSS pairs. The 28-pin PIC18F2550 has a single VDD pin, and people moving to the 40-pin chip often leave pin 32 or pin 31 open. The chip may even seem to work, until a heavy load or USB activity makes it reset.


PIC18F4550 I/O Ports (PORTA–PORTE)

The PIC18F4550 has 5 I/O ports with 34 I/O pins in total: PORTA (7), PORTB (8), PORTC (7), PORTD (8), and PORTE (4, including the input-only RE3). Every pin works at the VDD level (5v) and can sink or source 25mA, with 200mA for all ports together.

PIC18F4550 GPIO pins: PORTA RA0-RA6, PORTB RB0-RB7, PORTC RC0-RC7 (no RC3), PORTD RD0-RD7 and PORTE RE0-RE3

PortPins (DIP)BitsReset stateNotes
PORTA2–7, 14RA0–RA6RA0–RA3, RA5 analog; RA4 digital inputRA6 only in ECIO/INTIO modes (pin 14 is OSC2 with a crystal); RA4 is a full CMOS output here
PORTB33–40RB0–RB7RB0–RB4 analog (PBADEN = ON); RB5 = PGM (LVP = ON)Weak pull-ups (RBPU), INT0–INT2, interrupt-on-change on RB4–RB7
PORTC15–17, 23–26RC0–RC2, RC4–RC7Digital inputsNo RC3; RC4/RC5 are input-only USB pins
PORTD19–22, 27–30RD0–RD7Digital inputsSchmitt trigger inputs, optional pull-ups (RDPU), SPP data bus
PORTE8–10, 1RE0–RE3RE0–RE2 analog; RE3 = MCLRRE3 is input-only and needs MCLRE = OFF

Each port has the usual three registers: TRISx sets the direction (1 = input, 0 = output), PORTx reads the pins, and LATx writes the output latch. Write outputs through LATx, so a read-modify-write on PORTx never flips another pin by mistake.

Note: Most “my input always reads 0” problems on the PIC18F4550 come from the analog default: 13 pins are analog at reset. Add ADCON1 = 0x0F; at the start of main() (and #pragma config PBADEN = OFF) to make every pin digital. The comparators are already off at reset (CMCON = 0x07).

PIC18F4550 Interrupt Pins

PIC18F4550 External Interrupt Pins: INT0 on RB0 (pin 33), INT1 on RB1 (pin 34), and INT2 on RB2 (pin 35). RB4–RB7 (pins 37–40) add an interrupt-on-change on any edge, which is handy for a keypad or buttons with PORTB’s internal pull-ups.

Learn more in our PIC GPIO Tutorial.

Input Output Ports GPIO Pins in Microcontrollers

Also Read

PIC GPIO Tutorial


PIC18F4550 ADC Pins

The PIC18F4550 has a 10-bit ADC with 13 analog input channels (AN0–AN12) in the DIP-40 package. AN0–AN3 on RA0–RA3 are the easiest ones to use, because nothing else competes for those pins.

PIC18F4550 ADC pins (AN0 RA0, AN1 RA1, AN2 RA2, AN3 RA3, AN4 RA5, AN5-AN7 RE0-RE2, AN8-AN12 on RB0-RB4)

ChannelPin (DIP)PortAlso
AN02RA0–
AN13RA1–
AN24RA2VREF−, CVREF
AN35RA3VREF+
AN47RA5SS, HLVDIN, C2OUT
AN58RE0CK1SPP
AN69RE1CK2SPP
AN710RE2OESPP
AN835RB2INT2
AN936RB3CCP2 (alt)
AN1034RB1INT1, SCK, SCL
AN1137RB4KBI0, CSSPP
AN1233RB0INT0, SDI, SDA

The PCFG3:PCFG0 bits in ADCON1 select how many channels are analog, always counting up from AN0 (you can’t pick AN5 alone, for example). ADCON1 = 0x0E keeps only AN0 analog, and 0x0F makes everything digital. By default the ADC reference is VDD and VSS; RA3 and RA2 can bring in an external VREF+ and VREF−.

Note: Note that the channel numbers on PORTB aren’t in pin order (AN12 is on RB0 and AN10 is on RB1). And since PBADEN makes RB0–RB4 analog at reset, the I2C pins (RB0/RB1) won’t work until you make them digital.

Learn more in our PIC ADC Tutorial.

ADC With PIC Tutorial Thumbnail

Also Read

PIC ADC Tutorial


PIC18F4550 PWM Pins (CCP/ECCP)

PIC18F4550 Default PWM Pins: CCP1 on RC2 (pin 17) and CCP2 on RC1 (pin 16). Both use Timer2 as the time base, so they share one PWM frequency, with up to 10-bit duty-cycle resolution.

PIC18F4550 PWM and timer pins (CCP1/P1A RC2, CCP2 RC1 or RB3, P1B RD5, P1C RD6, P1D RD7, T0CKI RA4, T1OSO/T13CKI RC0)

SignalPin (DIP)PortNotes
CCP1 / P1A17RC2Capture, compare, PWM; ECCP output A
P1B28RD5ECCP half/full-bridge output B
P1C29RD6ECCP full-bridge output C
P1D30RD7ECCP full-bridge output D
CCP216RC1Default location (CCP2MX = ON)
CCP2 (alternate)36RB3With CCP2MX = OFF
FLT033RB0ECCP auto-shutdown input

On the 40-pin chip, CCP1 is an Enhanced CCP (ECCP): it can drive a half-bridge (P1A/P1B) or a full H-bridge (P1A–P1D) with programmable dead band and an auto-shutdown on the FLT0 pin, which makes it a good fit for DC motor control. The timer clock inputs are on RA4 (T0CKI) and RC0 (T13CKI for Timer1 and Timer3), and the 32.768kHz Timer1 oscillator goes on RC0/RC1.

Learn more in our PIC PWM Tutorial.

pwm | pulse width modulation tutorial

Also Read

PIC PWM Tutorial


PIC18F4550 UART Pins (EUSART)

PIC18F4550 UART Pins: TX on RC6 (pin 25) and RX on RC7 (pin 26). The PIC18F4550 has one EUSART, which also supports synchronous mode (CK/DT), auto-baud detection, and a 16-bit baud rate generator.

PIC18F4550 UART pins (EUSART TX/CK RC6 pin 25, RX/DT RC7 pin 26)

SignalPin (DIP)PortNotes
TX / CK25RC6Transmit (async) or clock (sync)
RX / DT26RC7Receive (async) or data (sync); also SPI SDO

Set TRISC6 = 1 and TRISC7 = 1 (inputs) and let the EUSART take over both pins when SPEN is set. The baud rate is calculated from the CPU clock, so it’s only right if your configuration bits really give you the Fosc you think (see the “4x too slow” problem below).

Note: RC7 is both the UART RX and the SPI SDO pin. You can’t use the EUSART receiver and the MSSP as an SPI master at the same time. If you need both, use I2C for the second peripheral or a software UART.

Learn more in our PIC UART Tutorial.

UART Serial Communication Tutorial With PIC Microcontroller

Also Read

PIC UART Tutorial


PIC18F4550 SPI and I2C Pins (MSSP)

The PIC18F4550 has one MSSP (Master Synchronous Serial Port) module that works either as SPI or as I2C, not both at once. The clock (SCK/SCL) is on RB1 (pin 34) and the data input (SDI/SDA) is on RB0 (pin 33) in both modes.

PIC18F4550 SPI Pins

PIC18F4550 SPI Pins: SCK RB1 (pin 34), SDI RB0 (pin 33), SDO RC7 (pin 26), and SS RA5 (pin 7, slave mode only).

PIC18F4550 SPI pins (SCK RB1 pin 34, SDI RB0 pin 33, SDO RC7 pin 26, SS RA5 pin 7)

SignalPin (DIP)PortDirection (master)
SCK34RB1Output (TRISB1 = 0)
SDI33RB0Input (TRISB0 = 1)
SDO26RC7Output (TRISC7 = 0)
SS7RA5Slave select input (slave mode); use any pin as CS in master mode

Learn more in our PIC SPI Tutorial.

SPI Tutorial - PIC Microcontrollers

Also Read

PIC SPI Tutorial

PIC18F4550 I2C Pins

PIC18F4550 I2C Pins: SDA on RB0 (pin 33) and SCL on RB1 (pin 34). Set both pins as inputs (TRISB0 = TRISB1 = 1), make them digital (ADCON1 = 0x0F), and add 4.7kΩ pull-up resistors to VDD.

PIC18F4550 I2C pins (SDA RB0 pin 33, SCL RB1 pin 34)

There are so many modules and sensors that we can interface with the PIC18F4550 using the I2C bus, which include: I2C LCD adapters (PCF8574), EEPROM memory chips, RTC clock modules (DS3231), MPU6050 IMU sensors, OLED display screens, and much more.

Learn more in our PIC I2C Tutorial.

I2C Tutorial With PIC Microcontrollers Thumbnail

Also Read

PIC I2C Tutorial


PIC18F4550 USB Pins

PIC18F4550 USB Pins: D− on RC4 (pin 23) and D+ on RC5 (pin 24), with the internal 3.3v regulator output on VUSB (pin 18). The full-speed USB 2.0 device module has its own transceiver, so you connect D+ and D− straight to the USB connector, with no resistors.

PIC18F4550 USB pins (D- RC4 pin 23, D+ RC5 pin 24, and the external transceiver pins RCV, VMO, VPO, UOE)

Pin (DIP)SignalFunction
23RC4 / D− / VMUSB data − (or VM input from an external transceiver)
24RC5 / D+ / VPUSB data + (or VP input from an external transceiver)
18VUSB3.3v regulator output for the transceiver and pull-up; 220nF–470nF to ground
16RC1 / UOEExternal transceiver output enable
6RA4 / RCVExternal transceiver receive input
35, 36RB2 / VMO, RB3 / VPOExternal transceiver outputs

Full-speed USB needs a 48MHz USB clock, which comes from the 96MHz PLL divided by 2. The PLL input must be exactly 4MHz, so the PLLDIV setting has to match your crystal (see the oscillator section). The internal 8MHz oscillator can run the CPU but can’t clock full-speed USB, so a USB design always needs a crystal or an external clock.

Note: RC4 and RC5 have no TRISC bits: they can never be outputs. With the USB module off (UCON.USBEN = 0 and UCFG.UTRDIS = 1), they work as digital inputs only. An LED on RC4 or RC5 will never light up.


PIC18F4550 SPP Pins (Streaming Parallel Port)

The PIC18F4550 has an 8-bit Streaming Parallel Port (SPP) on PORTD, made for streaming data between the USB endpoints and an external parallel device (an FPGA, a camera, or a memory) with little CPU work. It exists only on the 40/44-pin chips (PIC18F4455/4550).

SignalPins (DIP)PortFunction
SPP0–SPP319–22RD0–RD3Data bus, bits 0–3
SPP4–SPP727–30RD4–RD7Data bus, bits 4–7
CK1SPP8RE0Clock 1 output
CK2SPP9RE1Clock 2 output
OESPP10RE2Output enable
CSSPP37RB4Chip select

PIC18F4550 Oscillator Pins (Crystal and USB Clock)

PIC18F4550 Oscillator Pins: OSC1/CLKI on pin 13 and OSC2/CLKO on pin 14. For USB, the crystal is divided down to 4MHz by PLLDIV, multiplied to 96MHz by the PLL, and then divided by 2 for the USB module (48MHz) and by CPUDIV for the CPU.

CrystalPLLDIVClock modeCPUDIV for 48MHz CPUXC8 setting
4MHz÷1HSPLL_HS96MHz ÷ 2PLLDIV = 1
8MHz÷2HSPLL_HS96MHz ÷ 2PLLDIV = 2
12MHz÷3HSPLL_HS96MHz ÷ 2PLLDIV = 3
16MHz÷4HSPLL_HS96MHz ÷ 2PLLDIV = 4
20MHz÷5HSPLL_HS96MHz ÷ 2PLLDIV = 5
24MHz÷6HSPLL_HS96MHz ÷ 2PLLDIV = 6

With the PLL on, the CPUDIV names are confusing: CPUDIV = OSC1_PLL2 means “96MHz ÷ 2 = 48MHz“, OSC2_PLL3 means 32MHz, OSC3_PLL4 means 24MHz, and OSC4_PLL6 means 16MHz. Without the PLL (HS mode), the same setting would divide the crystal frequency instead. A 40MHz or 48MHz source works only as an external oscillator (EC modes, PLLDIV ÷10 or ÷12), not as a crystal.

Note: A blank PIC18F4550 starts in EC mode (it expects an external clock on OSC1) with the watchdog timer on. With only a crystal fitted, it won’t run until you program the configuration bits. The internal 8MHz INTOSC (with 31kHz INTRC) is fine for non-USB projects.

Learn more in our PIC Configuration Bits Tutorial.


PIC18F4550 ICSP Programming Pins

The PIC18F4550 is programmed over ICSP (In-Circuit Serial Programming) with 5 signals: MCLR/VPP (pin 1), PGC (pin 39), PGD (pin 40), VDD, and VSS, plus PGM (pin 38) for low-voltage programming. Here’s how the standard 6-pin PICkit header maps to the chip:

PIC18F4550 ICSP programming pins (MCLR/VPP pin 1, PGM RB5 pin 38, PGC RB6 pin 39, PGD RB7 pin 40)

ICSP header pinSignalPIC18F4550 pin (DIP)
1MCLR/VPP1
2VDD11 (and 32)
3VSS12 (and 31)
4PGD40 (RB7)
5PGC39 (RB6)
6PGM / LVP38 (RB5), only for low-voltage programming
  • PICkit 3/4/5 and MPLAB ICD: high-voltage programming (VPP of 9v–13.25v on MCLR), with MPLAB X IDE and the XC8 compiler. Pin 6 of the header can stay unconnected.
  • MPLAB SNAP: it can’t generate the high VPP voltage, so it programs the PIC18F4550 in low-voltage mode only. That means LVP must stay ON, and RB5 belongs to the programmer.
  • USB HID bootloader: many projects program Microchip’s USB HID bootloader once over ICSP, then load new firmware over USB with no programmer.
  • Debugging takes PGC and PGD (and a little RAM and Flash), so keep those pins free while you debug.

Note: With the default LVP = ON, RB5 is the PGM pin, not an I/O. If RB5 floats or goes high, the chip enters programming mode and looks like it resets or freezes at random. Set LVP = OFF when you use a PICkit, or pull RB5 low with a 10kΩ resistor.


Getting Started With PIC18F4550

To program the PIC18F4550, install MPLAB X IDE and the free MPLAB XC8 compiler (the old MPLAB C18 compiler is legacy), build the minimal circuit, and connect a PICkit to the ICSP header. Here’s a complete XC8 example for the 20MHz crystal circuit: the configuration bits for 48MHz and USB, PORTB made digital, and an LED blinking on RD0.

The gotcha in this code is the ADCON1 = 0x0F; line: without it (or PBADEN = OFF), RB0–RB4 and the PORTA/PORTE analog pins read 0 as digital inputs. Learn more about the configuration bits and the rest of the peripherals in our PIC Microcontrollers Programming Tutorials series, and for a ready-made board, check out the PIC18F Development Board.


PIC18F4550 Common Problems & Fixes

Why does my PIC18F4550 reset or freeze at random? Usually RB5 is floating while LVP is ON (the default), so the chip enters programming mode. Set LVP = OFF or pull RB5 low (picbasic.co.uk). A missing MCLR pull-up does the same.

Why do my PORTB inputs always read 0? RB0–RB4 are analog at reset (PBADEN = ON), along with RA0–RA3, RA5, and RE0–RE2. Write ADCON1 = 0x0F; or set PBADEN = OFF.

Why won’t my LED on RC4 or RC5 light up? RC4 and RC5 are input-only USB pins with no TRISC bits (CCS forum). Move the LED to another pin.

Why does Windows say “USB device not recognized”? Check the 220nF–470nF capacitor on VUSB (pin 18), set VREGEN = ON (it’s off by default, per errata DS80478), match PLLDIV to your crystal, and check that D+ (pin 24) and D− (pin 23) aren’t swapped (picbasic.co.uk).

Why does my code run 4x too slow, or my UART baud rate come out wrong? The configuration bits don’t give the clock your code assumes: a wrong FOSC (HS instead of HSPLL_HS), PLLDIV, or CPUDIV. With a 20MHz crystal, use FOSC = HSPLL_HS, PLLDIV = 5, CPUDIV = OSC1_PLL2 for 48MHz (picbasic.co.uk).

Why doesn’t my brand-new chip run with a crystal? A blank PIC18F4550 defaults to EC (external clock) mode with the watchdog on. Program the configuration bits first.

Can I use RA4 as an open-drain output like on the PIC16F877A? No. On the PIC18F4550, RA4 is a full CMOS output that drives both high and low.


PIC18F4550 vs PIC18F4455 vs PIC18F2550 vs PIC18F45K50 vs PIC16F877A

The PIC18F4550 has 4 close relatives that students and makers compare it with. Here’s how they differ:

FeaturePIC18F4550PIC18F4455PIC18F2550PIC18F45K50PIC16F877A
Pins (DIP)4040284040
Pin compatible with the PIC18F4550–Yes, same pinsNo (28-pin map)YesSame footprint, different functions
Flash32KB24KB32KB32KB14KB
Max CPU clock48MHz48MHz48MHz48MHz20MHz
USBFull speedFull speedFull speedFull speed, crystal-free optionNo
ADC13-ch 10-bit13-ch 10-bit10-ch 10-bitMore channels, ANSELx registers8-ch 10-bit
ECCP / SPPYes / YesYes / YesNo / NoYes / NoNo / No (PSP instead)
LVP pinRB5RB5RB5RB5RB3

The PIC18F4455 is the same chip with less Flash, so this whole article applies to it. The PIC18F2550 is the 28-pin version (no PORTD, no PORTE except RE3, a single VDD pin), so its pin map is different. The PIC18F45K50 is Microchip’s newer, pin-compatible replacement: it can run USB from its internal oscillator without a crystal and works at lower voltages, but its configuration bits and analog registers (ANSELx instead of ADCON1) differ, so the code needs porting. The PIC16F877A is the classic 40-pin teaching chip with no USB and a slower core.


PIC18F4550 Pin Configuration

Here is the complete PIC18F4550 pin configuration for all 3 packages: the DIP-40 pin number, its TQFP-44 and QFN-44 numbers, every function, the pin type and reset state, and a short description. On the DIP-40, pin 1 is top-left next to the notch, and the pins count counter-clockwise (pin 40 is opposite pin 1).

Click to expand the full pin table (42 pins)
DIP-40TQFP-44QFN-44Pin nameFunctionsType / reset stateDescription
11818MCLR/VPP/RE3MCLR (reset, active low), VPP, RE3Input · MCLR at resetMaster clear reset with a 10kΩ pull-up to VDD, the 9v–13.25v programming voltage input, or the RE3 digital input when MCLRE = OFF.
21919RA0AN0I/O · analog at resetAnalog input AN0; set ADCON1 = 0x0F to use it as a digital pin.
32020RA1AN1I/O · analog at resetAnalog input AN1; digital only after ADCON1 is set.
42121RA2AN2, VREF−, CVREFI/O · analog at resetAnalog input AN2, the ADC negative reference input, or the comparator reference voltage output.
52222RA3AN3, VREF+I/O · analog at resetAnalog input AN3 or the ADC positive reference input.
62323RA4T0CKI, C1OUT, RCVI/O · digital inputTimer0 clock input and comparator 1 output; a full CMOS output on this chip (not open drain), with a Schmitt trigger input.
72424RA5AN4, SS, HLVDIN, C2OUTI/O · analog at resetAnalog input AN4, the SPI slave select input, the HLVD input, or comparator 2 output.
82525RE0AN5, CK1SPPI/O · analog at resetAnalog input AN5 or the SPP clock 1 output.
92626RE1AN6, CK2SPPI/O · analog at resetAnalog input AN6 or the SPP clock 2 output.
102727RE2AN7, OESPPI/O · analog at resetAnalog input AN7 or the SPP output enable.
11287, 8VDDSupplyPowerPositive supply (4.2v–5.5v for 48MHz); decouple with 100nF to pin 12.
12296VSSGroundPowerGround for the pin 11 supply pair.
133032OSC1/CLKICrystal in, external clock inOscillatorCrystal or resonator input, or the external clock input (EC modes).
143133OSC2/CLKO/RA6Crystal out, CLKO, RA6Oscillator · CLKO at resetCrystal output, the Fosc/4 clock output in EC mode, or the RA6 I/O in ECIO and INTIO modes.
153234RC0T1OSO, T13CKII/O · digital inputTimer1 oscillator output, or the Timer1/Timer3 external clock input.
163535RC1T1OSI, CCP2, UOEI/O · digital inputTimer1 oscillator input, the default CCP2 PWM output (CCP2MX = ON), or the external USB transceiver output enable.
173636RC2CCP1, P1AI/O · digital inputCCP1 capture/compare/PWM, and the ECCP P1A output.
183737VUSBUSB 3.3v regulatorPower (output)Internal 3.3v USB regulator output: put 220nF–470nF to ground and never feed 5v into it.
193838RD0SPP0I/O · digital inputPORTD bit 0 and SPP data bit 0.
203939RD1SPP1I/O · digital inputPORTD bit 1 and SPP data bit 1.
214040RD2SPP2I/O · digital inputPORTD bit 2 and SPP data bit 2.
224141RD3SPP3I/O · digital inputPORTD bit 3 and SPP data bit 3.
234242RC4/D−/VMD−, VMInput onlyUSB D− line; a digital input only (no TRISC bit) and only when the USB module is off.
244343RC5/D+/VPD+, VPInput onlyUSB D+ line; a digital input only (no TRISC bit) and only when the USB module is off.
254444RC6TX, CKI/O · digital inputEUSART transmit (asynchronous) or clock (synchronous).
2611RC7RX, DT, SDOI/O · digital inputEUSART receive or data, and also the SPI data output, so the UART RX and SPI master can’t be used together.
2722RD4SPP4I/O · digital inputPORTD bit 4 and SPP data bit 4.
2833RD5SPP5, P1BI/O · digital inputSPP data bit 5 and the ECCP P1B PWM output.
2944RD6SPP6, P1CI/O · digital inputSPP data bit 6 and the ECCP P1C PWM output.
3055RD7SPP7, P1DI/O · digital inputSPP data bit 7 and the ECCP P1D PWM output.
31630, 31VSSGroundPowerGround for the pin 32 supply pair.
32728, 29VDDSupplyPowerSecond positive supply pin; wire it and decouple it with 100nF to pin 31.
3389RB0AN12, INT0, FLT0, SDI, SDAI/O · analog at reset (PBADEN)External interrupt INT0, the ECCP fault input, SPI data in, and the I2C SDA line.
34910RB1AN10, INT1, SCK, SCLI/O · analog at reset (PBADEN)External interrupt INT1, and the SPI clock or I2C SCL line.
351011RB2AN8, INT2, VMOI/O · analog at reset (PBADEN)External interrupt INT2 and analog input AN8.
361112RB3AN9, CCP2, VPOI/O · analog at reset (PBADEN)Analog input AN9, or the CCP2 PWM output when CCP2MX = OFF.
371414RB4AN11, KBI0, CSSPPI/O · analog at reset (PBADEN)Analog input AN11, an interrupt-on-change pin, and the SPP chip select.
381515RB5KBI1, PGMI/O · PGM at reset (LVP)Interrupt-on-change pin, and the low-voltage programming pin while LVP = ON (the default).
391616RB6KBI2, PGCI/O · digital inputInterrupt-on-change pin and the ICSP programming clock.
401717RB7KBI3, PGDI/O · digital inputInterrupt-on-change pin and the ICSP programming data line.
–12, 13, 33, 34–NC / ICPORTSICCK/ICPGC, ICDT/ICPGD, ICRST/ICVPP, ICPORTSTQFP-44 onlyA dedicated debug port when ICPRT = ON; not connected otherwise.
––13NC–QFN-44 onlyNot connected.

The TQFP-44 and QFN-44 packages have the same functions as the DIP-40, just on different pin numbers. On the QFN-44, the supply is split over more pins (7, 8, 28, and 29 are VDD; 6, 30, and 31 are VSS), so connect every one of them.


Wrap Up

To conclude this guide article, the PIC18F4550 is still one of the easiest ways to add USB to a project with a breadboard-friendly DIP chip. Just remember its reset-state traps: LVP owns RB5, 13 pins start as analog, RC4/RC5 are input-only, and USB needs the VUSB capacitor, VREGEN = ON, and the right PLLDIV for your crystal.

I hope you’ve found this guide helpful in deciding which pins to use for your project. For more chips and boards, check out the Pinouts, Datasheets & Schematic Diagrams Library. Follow this PIC Microcontrollers Series of Tutorials to learn more about programming PIC microcontrollers with MPLAB XC8.

If you’re just getting started with PIC microcontrollers, you need to check out the PIC Programming Introductory Tutorial below.

PIC Microcontrollers Programming Introductory Tutorial

The beginner’s guide to PIC microcontrollers: how they work, the MPLAB X and XC8 toolchain, and your first PIC project, step by step.

Share This Page With Your Network!
Join Our +25,000 Newsletter Subscribers!

Stay Updated With All New Content Releases. You Also Get Occasional FREE Coupon Codes For Courses & Other Stuff!

Photo of author
Author
Embedded systems engineer with several years of experience in embedded software and hardware design. I work as an embedded SW engineer in the Automotive & e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI/ML, and other fields I'm passionate about.
I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?

Leave a Comment