Rustic Engineering

My Mind working on…

OLED Display (SH1101A) and DS18B20 (with C18 example code for download)

with 12 comments

For who need SH1101A OLED driver, I’m posting here my code (written in Microchip C18, but easly to port to other platform) to help more people on get use this great OLED display. It’s not finished, yet, but it’s very useful.

Demo code running


The code has geometric draw functions to draw single pixel, lines, rectangles and circles with fill option. There’s  characters output functions too, with 8×6 pixel font.

The icons for Battery (animated), Bluetooth, WiFi, Sound (animated), etc are on the code too.

Some example of available functions are:

  • SetPixel(), GetPixel();
  • Line();
  • Bar();
  • Character output functions, PutROMString(), PutString();
  • PutImage();

In the code you’ll find a DS18B20 Dallas OneWire Digital Temperature sensor driver too. That’s a limited version (only work for one sensor in OneWire bus) but works great. You get a float reading plus a string with temperature value (in Celsius Degrees). More improvements coming soon.

Well, let’s go to download link:

DS18B20 with 12bit resolution!

If you have any trouble with that code, email-me or let me a comment.

Written by forrequi

November 26, 2010 at 01:03

12 Responses

Subscribe to comments with RSS.

  1. Muito bom cara! Estou voltando a mexer com o display de oled 128×64 e o seu código vai me ajudar bastante, estou tentando fazer fontes grandes (25×48) pra fazer uma espécie de display de relógio (e.g., “12:45”). Valeu!


    December 3, 2010 at 23:37

  2. hey ..nice work..any ideas of having the code been used for SPI interface for the display.
    void OledWrite(BYTE data)


    December 15, 2010 at 11:30

    • Yes, I’m working on a version 2 of code, with SPI option. Stay plugged this weekend for download it.


      December 15, 2010 at 13:35

  3. Wow – where do you get a nice oled like that.


    January 5, 2011 at 12:24

  4. Hi,

    would you share the schematics of the breakout pcb ?



    September 20, 2011 at 03:12

  5. Download isn’t working. I would love to know if you got spi working….and how


    September 26, 2011 at 23:24

    • I’ll fix it and inform you. Thank you for your interest.


      September 27, 2011 at 07:17

    • Just send the file to you, via email. The downloads page works for me. Bye


      September 27, 2011 at 07:32

  6. i try this code with pic18F2550,but with under frequency “4Mhz” ,so i changed the delays to be confortable for my CPU clock…..but it doesn’t work….please help me!!!!


    May 6, 2014 at 21:28

    • Did you know if your display controller is really the SH1101A? Some of this displays have the same aspect, but the majority of them uses diferent controllers. The most common don’t are teh SH1101A, because its dont support I2C, and its a nice feature today.


      May 9, 2014 at 14:34

      • thank you resoulue the problem of frequency, but when testing with PIC18F2550. the DS18B20 only gives the ré not work to the point that it works correctly with isis …. please help me with what I am preparing my end of study project on it!!


        May 19, 2014 at 12:33

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: