chipKIT® Development Platform

Inspired by Arduino™

Communicating to the 1.5" Sparkfun OLED SSD1351

Created Tue, 05 Jun 2012 16:17:48 +0000 by nik999389


Tue, 05 Jun 2012 16:17:48 +0000

Hey Everyone!

I'm using a chipkit uno32 to try to communicate with an Sparkfun OLED board. Here's the link to the board:


I'm trying to use a library that is on that website:


This library was written up for an Atmega644p, that means that the lower level commands are going to be different. There's a whole section on the code that is set out just for lower level functions:

/* data */
#define SetData(x)	(PORTA = (x))		// A7-A0 is OLED D7-D0
#define GetData()	(PINA)
#define GetData8()	(PINC & 0x80)		// C7 is OLED D8
#define Data8High()	(PORTC |= 0x80)
#define Data8Low()	(PORTC &= ~0x80)
#define SetupDataOutput()	{ DDRA = 0xff; DDRC |= 0x80; }
#define SetupDataInput()	{ PORTA = 0; DDRA = 0; PORTC &= ~0x80; DDRC &= ~0x80; }

/* control */
#define EHigh()		(PORTC |= 0x40)		// C6
#define ELow()		(PORTC &= ~0x40)
#define RWHigh()	(PORTC |= 0x20)		// C5
#define RWLow()		(PORTC &= ~0x20)
#define CSHigh()	(PORTC |= 0x10)		// C4
#define CSLow()		(PORTC &= ~0x10)
#define DCHigh()	(PORTC |= 0x08)		// C3
#define DCLow()		(PORTC &= ~0x08)
#define ResetHigh()	(PORTC |= 0x04)		// C2
#define ResetLow()	(PORTC &= ~0x04)

#define InitOLEDLines() { SetupDataOutput(); DDRC |= 0x7c; }

Unfortunately I'm not very good at lower level functions, I know how to set up the port pins but I'm not too clear on what the PINC command means.

I've tried setting this up and it's not working. The library says it uses the 6800 serial MCU interface of the SSD1351 graphics processor but then instructs you to set the pins BS1 GND to and BS2 to VCC and if that's true then your using the LCD in it's 8080 serial MCU interface and there are some differences in it's usage.

I've also adjusted the clock cycle waits in the code. Since the library was set up for an 8MHz uC adn the uno32 uses 80 MHz i just multiply the asm("nop") iterations by 10.

Also it has been brought to my attention that this board might have some problems on it;

This explains how there is a problem with tying some of the pins low and also sending a 1 as the 1st MSB of the second byte causes unexpected results.

All and all I'm trying to see if there is anything I missed, any alteration that I forgot to do to this code. I would greatly appreciate some feedback. Thanks!