Interfacing PIC18F4550 with SSD1306 OLED

This topic shows how to interface PIC18F4550 microcontroller with SSD1306 OLED display       (128×64 pixel). The SSD1306 is a monochrome display which means it has only one color (white, blue, yellow …). Also I will show how the simulation of this project (PIC18F4550 + SSD1306 OLED) with Proteus ISIS.

The SSD1306 OLED display communicates with the master device over I2C mode, SPI mode or 8-bit parallel mode. In this project I’m going to use the I2C mode.
In the I2C mode there are two lines between the microcontroller and the SSD1306 OLED display board: SDA (serial data) and SCL (serial clock). An additional pin for hardware reset is required if the display has a reset pin.
So, make sure that your SSD1306 OLED display is configured to work in I2C mode, some displays need jumper placing or soldering.

Hardware Required:

  • PIC18F4550 microcontroller
  • SSD1306 OLED display
  • 5V source
  • Breadboard
  • Jumper wires

PIC18F4550 with SSD1306 OLED display

Interfacing PIC18F4550 with SSD1306 OLED display circuit:
Circuit diagram is shown below.

PIC18F4550 SSD1306 OLED display circuit

(All grounded terminal are connected together)

The PIC18F4550 microcontroller has one hardware I2C module with SDA on pin RB0 (#33) and SCL on pin RB1 (#34). The SDA pin of the MCU is connected to the SDA pin of the display and the SCL pin of the MCU is connected to the SCL pin of the display.
The reset pin of the display is connected to pin RB2 (#35) of the microcontroller.

The SSD1306 OLED display DC pin is connected to VDD which means the I2C slave address of the display is 0x7A.

In this project the PIC18F4550 runs with its internal oscillator and MCLR pin function is disabled.

The Code:
The C code below is for CCS C compiler, it was tested with version 5.051.

To be able to compile the C code below with no error, a driver for the SSD1306 OLED display is required, it’s name is SSD1306OLED.C, for more information about this driver, visit the following post:
SSD1306 OLED Library for CCS C compiler

It can be downloaded also from the link below:
SSD1306 OLED Library download

after the download, add the driver file to project folder or CCS C compiler drivers folder.

The example code is a modified version of an Adafruit example for a 128×64 pixel display.

CCS C code:

The following video shows a simple hardware circuit of the project:

Proteus simulation:
This project can be simulated with Proteus simulation software, but it will not give a prefect result as the real hardware circuit. The simulation file can be downloaded from the link below, use Proteus version 8.6 or higher to open it:
PIC18F4550 + SSD1306 OLED

and the video below shows the simulation result:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

5 thoughts on “Interfacing PIC18F4550 with SSD1306 OLED”

  1. Fernando Colcombet

    So when I change the pic18f4550 for the pic18f14k50, but i see the error in CCS compiler than say “no enough RAM for all variables”, what can i change for solve this error?

  2. I bought that microcontroller and I made it work. Warning:
    Some SSD1306 controllers has different address:
    0x3C
    0x3D
    0x78
    0x7A

    Now, I do have a question: How can I change the presentations in order to adapt the adafruit logotype and others to my OLED 128×32?

    I have to change the constants on the library, like that one?
    const char Font[] = {
    0x00, 0x00, 0x00, 0x00, 0x0…

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top