There is no USPS pickup on Monday Feb 15th, 2016 because of President's Day. USPS orders placed after 11am EST Fri February 12th will go out Tuesday February 16. UPS orders will ship as normal.

Character only library for OLED display
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Character only library for OLED display

by fat16lib on Wed Feb 29, 2012 4:15 pm

I wrote a character only library for the Monochrome 128x32 OLED graphic display. It should also work on the 128x64 display but I have not tested it since I don't have this display.

This library is not buffered so it uses about 500 bytes less RAM than the Adafruit graphic library.

This neat tiny display can used in place of a standard LCD in projects that are short of RAM by using this library.

The file is SSD1306ASCII20120229.zip at http://code.google.com/p/beta-lib/downloads/list.

Here is the readme file:
SSD1306ASCII is an unbuffered character only library for an Adafruit 1306
OLED display. The SSD1306ASCII library only requires a few bytes of RAM.

SSD1306ASCII implements a small part of the LiquidCrystal API. Implemented
functions include clear(), home(), print(), setCursor(), and write().

It has only been tested with the "Monochrome 128x32 OLED graphic display".

http://www.adafruit.com/products/661

To use this library, copy the SSD1306ASCII folder to your libraries folder.

Edit SSD1306ASCII.h and select your display type. The default is:

// #define SSD1306_128_64
#define SSD1306_128_32

Select the font that will be used by defining FONT_TYPE. The default is:

#define FONT_TYPE 1

This is an 96 character version of the Adafruit glcdfont.

See SSD1306fonts.pdf for a rough representation of other choices.

Try the ssd1306HelloWorld example first.

The ssd1306ShowFont example displays all characters in the font.

The ssd1306FontMap example was used to generate SSD1306fonts.pdf.
fat16lib
 
Posts: 593
Joined: Wed Dec 24, 2008 1:54 pm

Re: Character only library for OLED display

by Desert_Rat on Fri Apr 13, 2012 5:34 pm

Thank you! Since my little project doesn't require graphics, only text I easily replaced the Adafruit library with this one and not only did it give me a little more RAM, it reduced the program code itself about 2k as well.
This is great for those that don't require fancy graphic capabilities and only use text.
---------------------------------------------------------------------------------
I went from living in a van down by the river to a shack in the desert.
Meh, at least it's an upgrade.
User avatar
Desert_Rat
 
Posts: 5
Joined: Sun Mar 18, 2012 5:04 am

Re: Character only library for OLED display

by zulucat on Tue Apr 17, 2012 2:40 am

fat16lib wrote: ... It should also work on the 128x64 display but I have not tested it since I don't have this display ...


I did some quick testing with my 128x64 display. Both HelloWorld and ShowFont examples work with the bigger display.
User avatar
zulucat
 
Posts: 27
Joined: Thu Nov 17, 2011 12:43 am
Location: Southern SoCal

Re: Character only library for OLED display

by davegior on Sat May 05, 2012 8:05 pm

Fantastic. Much easier to use than the sample librarary. Thank you for sharing it with us.
Question: is there a character for Omega? Ω
davegior
 
Posts: 9
Joined: Mon Apr 30, 2012 11:56 am
Location: NYC

Re: Character only library for OLED display

by buton on Wed Feb 27, 2013 10:19 am

just what i was looking for...

thanks
buton
 
Posts: 54
Joined: Fri May 11, 2012 8:06 am

Re: Character only library for OLED display

by nyukin on Sat Jan 04, 2014 8:04 pm

This post may be a couple years old, but this library looks perfect for an application I need. Thanks for sharing. I'm happy my RAM constrained sketch might still run despite swapping a lower res display for the 128 x 64 OLED. Can't wait for it to arrive from Adafruit. 8)

Edit: yep, subbing this library for the PCD8544 with the Nokia 5110 84 x 48 LCD uses exactly 1 more byte of RAM for me. This compares to 84x48/2=504 bytes in the frame buffer for that library and 128x64/8 bytes if we buffer in RAM like with the regular Adafruit graphics library.

Also I fixed a few simple compilation errors that occur with newer versions of avr-gcc like in Arduino 1.03, which I'm using in my linux environment. You can read more at https://github.com/jcw/ethercard/pull/91.

Each of the font.h files need
Code: Select all | TOGGLE FULL SIZE
const
prepending the line that reads
Code: Select all | TOGGLE FULL SIZE
static unsigned char font[] PROGMEM = {
This is also true for the SSD1306ASCII.cpp file for the two lines reading
Code: Select all | TOGGLE FULL SIZE
uint8_t *base = font + 5 * c;


Maybe this well help somebody else in a few years? :wink:
Last edited by nyukin on Sat Jan 04, 2014 9:05 pm, edited 2 times in total.

nyukin
 
Posts: 8
Joined: Tue Jan 25, 2011 5:25 am

Please be positive and constructive with your questions and comments.