Bitmap for OLED displays

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

 Hi,

   

I got a SSD1306 OLED display from eBay to work using some code contributed by a community member.  The code is based on an Adafruit library.  See the attached project.  I cannot, however seem to get a bitmap to display.  I am using this program to convert a .bmp to a char array, but it comes up on the display as garbage, though it seems there is some hint of the image there.  

   

Library:

   

https://github.com/adafruit/Adafruit-GFX-Library

   

Converter tool:

   

http://en.radzio.dxp.pl/bitmap_converter/

   

Any ideas?

   

Thank you,
Tom

0 Likes
14 Replies
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

 Never mind, the code works fine, I just had to use horizontal byte orientation instead of vertical in the converting software.  These OLEDs are beautiful and cheap on eBay.  No excuse not to have one on a project.

   

Thank you,
Tom

0 Likes
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

 Hi,

   

One other question.  Is there a simple way to store initial data in flash besides using the EM_EEPROM?  Arduino has a PROGMEM designator, is there something similar in PSOC?  

   

I am trying to store bitmap data for an OLED display, and it does not work in just a standard array.  Why can't the processor recall this array after power off?  It seems to recall other arrays and variables that I set up as constants.

   

Thank you,
Tom

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You may declare an array as

   

static const uint8 MyArray[YourSize] = {0x01,0x02,... and so on.

   

"const" and the initialization are absolutely requred to have that "variable" located in flash.

   

Structs are allocated in flash similarly.

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

 Hi,

   

See attached.  This is basically an animation of 4 fans on the OLED.  It works great for the initail program, but does not display them when power is cycled.  Any help is greatly appreciated, as usual!

   

Thank you,
Tom

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Your program is straightforward and I cannot see an uninitialized variable. So a chance might be that there is a timing issue when toggling power. Does a reset show the same problem?

   

 

   

Bob

0 Likes
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

 Hi,

   

A reset preserves the data (and animation) and a power off does not.
Thank you,

   

Tom

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

then I would suggest to put a delay (0.1 to 0.5s) before initializing the display.

   


Bob

0 Likes
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

 Right on!  100ms seems to be a good minimum for what I have.

   

Thank you,

   

Tom

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You are always welcome, Tom!

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Not to rain on your parade, but would it not be prudent to figure

   

out approximately where the delays are coming from and their cause,

   

size ? Just to be sure one device to another you have predictable behaviour

   

and can be assured that the delays you currently are implementing are not

   

masking a more serious problem that may bite you in the great divide at

   

a later time.

   

 

   

Just a thought.

   

 

   

Regards, Dana.

0 Likes
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

 Sorry to once again appear quite ignorant, but how would I go about this?  It is a fairly simple piece of code right now, how would I tackle it?

   

Thank you,

   

Tom

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I did not go deep into the specs of your OLED display, but as most devices there is a time needed before it is able to react to commands after power is supplied.When the PSoC is ready first and starts sending commands that would go amiss.

   

A review of the datasheet concerning power on sequence shows a delay of 100ms after initialization.

   

Additionally I would monitor the power supply when switching on, there could be some unwanted glitching or a ramp too slow.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

These are the requirements for power up and down -

   

 

   

0 Likes
Anonymous
Not applicable

Tom,

On the link you listed from Adafruit i do not see any down loads for PSoC adjusted code.  Were did you get the adjusted code for PSoC version for SSD1306?

Scott

0 Likes