Instruments4Chem

High Performance, Low Cost…

Working with OLED Displays


OLED’s are relatively inexpensive and can be very useful for displaying small images and text/graphics. Many of the types offered for sale on EBay use a Solomon Systech display controller that provides the user with a useful set of primitives for generating user-defined graphics.

For example the SSD1339 controller has a number of commands as listed below :

SSD1339 Command Set

Set column address $15
Set row address $75
Write ram $5C
Draw line $83
Draw rectangle $84
Draw circle $86
Clear area $8E
Address increment mode and color depth $A0

In this project a low cost XMOS Startkit shield has been developed to experiment with an OLED display. The display being used here has 132 columns (0-131) and 132 rows (0-131). Communications with the OLED can be performed via either a serial or a parallel interface; in the design described here we are using the former method. The serial interface requires 5 single bit ports, with connections as follows :

XMOS Startkit pin = OLED pin

1G = SCLK (D0)
1E = SDIN (D1)
1J = RES
1K = D/C*
1N = CS*

If a parallel interface is not being employed, pins D8..2, E/RD# and R/W# should all be connected to GND.
Serial communications with the OLED controller are straightforward to implement and make use of the four pins - D/C*,CS*,SCLK (D0) and SDIN (D1). Note that D/C* is the data/command pin; high=data, low=command.

To send either commands or data in byte-wise fashion, one first sets up D/C*, then pulls CS* low, then sends data bits in MSB-to-LSB order for a total of 8 bits transferred per transaction, with the data SDIN being latched in on clock (SCLK) rising edges.

The controller also has an active low RESET pin.

In the XC code developed to drive the OLED, a 912 byte character RAM array was declared and loaded with pixel data to implement a custom character set. This array represents each character as an 8x8 grid of pixel data.

The character generation strategy can then be described as follows -

set horizontal address increment mode
set background and text colors

loop over 8 rows
next row - get next character
move to start position (r,c)

loop over 8 columns
if bit = 0 write ram black_color
else if bit = 1 write ram text color
end loop
end loop
The image opposite shows the XMOS Startkit OLED shield in operation. The OLED panel connects via its short ribbon cable to the 30 pin connector on the right hand side of the PCB.

A 2 MB SRAM chip and an SD card are also provided on the shield as a means to store and rapidly access images.

Additional information about these features can be found in the description of our data acquisition shield found here.