News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

OLED libraries for SSD1306 and SH1106

Started by Dompie, Feb 05, 2021, 11:30 AM

Previous topic - Next topic

Dompie

Sorry was on vacation :-)
These are completely new displays for me, so no experience with them.
The SSD1306 library uses I2C address $3C and not $3D. This is already a problem (in the .def file you can change the I2C address on line 44). I don't know whether the solder pad next to the text A0 does anything. Maybe you can switch between $3C and $3D with this.
But IF (a big IF) the board is on I2C by default then GND, Vin, Clk and Data should be connected I think and the address in the SSD library should be changed to $3D. Possibly this could work. However, I feel very suspicious of whether this is the solution.

Johan

Yves

Ho Johan,

Thank you for your input. It was a matter of changing the address to $3D.

Regards,

Yves
Yves

Dompie

In the next release I will make it possible to change the address with a $define

Johan

Yves

Hello All,

is it possible to delete a single text line without deleting the whole screen?

Yves

Regards
Yves

Dompie

I delete a single line or more with FillRectangle(x0, y0, x1, y1, Color) color black.

Johan

Yves

Hi Johan,
I'battling to clear a single line from your explanation. For example,

SelectFont(Arial_8)
FillRectangle (4,28,4,40,0) 'draw a filled rectangle delete the display
Print At 4,35, "The run time is: ",Dec0 loop_seconds," sec."
RefreshDisplay()

I'm not getting the desired result

Cheers,

Yves 
Yves

Pepe

FillRectangle (4,28,x,40,0)
x is 4 + size of text

example
Print At 4,28, "hello"
FillRectangle (4,28,40,40,0)

Yves

Thanks, Pepe for your suggestion. I have now figured it out as below:

    FillRectangle (4,35,120,45,0)'     Erasing the line
    Print At 4,35, "The run time is: ",Dec0 loop_seconds," sec."
    Print At 8,50, "Start/Stop to continue"
    RefreshDisplay()

Cheers,

Yves

Yves

Dompie

Hi Yves, yes, that's what I meant. hmmm next time I'll answer a little more extensively

Johan

Yves

Hello all,

I'm using the latest version of the SSD1306. I need a bip in my code using this: Sound Sounder,[125,10]. Strange enough if I test it before the SSD1306 first Print command it work fine but after the SSD1306 print command it is the sound command is not working at all. Any explanation why?

Cheers,

Yves
Yves

Dompie

Oh Yves I don't see any connection and can't think of anything because the code is very straight forward and doesn't use any special things. In addition, the used system variables have been reset to their original entry values after the print statement so I really don't know unfortunately.

Johan

Dompie

#31
Finally time to adjust the Graphic&SSD1306 libraries. As far as I know all anomalies have now been resolved. Some wishes have also been implemented
The main changes are:
- Positron 4.0.2.0 compatible
- I2C via Hardware or Software
- I2C address changeable (for special SSD1306 hardware)
- no asm routines anymore (so useable for >64K flash PICs)
- no SPI support anymore

In the Download area you will find the new version of Graphic&SSD1306_20220701

With completely new projects it might be useful to look at UGL from @atomix because it supports many more displays than the SSD1306 alone

Johan
[EDIT: Ohhhhhhh the enclosed .hex is Software I2C on RC0=SDA_pin RC1=SCL_pin. The .bas is for hardware I2C configurated. So please recompile if needed]

Yves

Thank you Johan.

This new version is very elegant and far more comprehensible for people like myself. I so glad the I2C ports are now fully interchangeable. Very good job and many thanks again.

Regards,

Yves
Yves

John Lawton

Great work.

Any suggestions for suitable displays (on Ebay etc) to have a play with, please?

Dompie

There is a wide range of 0.91inch or 1.3inch OLED displays with I2C on AliExpress and Ebay. Note that there is an SSD1306 controller on it and NOT an SH1106 (although it often states that the SH1106 is compatible with the SSD1306 but that is NOT true). These displays have a 4 pin connection (VDD GND SCK SDA) where the pin order sometimes differs and SCK is sometimes called SCL. Furthermore, the displays have blue or white pixels. I always use the white one for better readability.
My last OLED display order (1.3inch, SSD1306, I2C and white) is over a year ago so I can't give any recent purchase advice.

Johan


John Lawton

Thanks very much Atomix. These prices are incredibly low, but the delivery times are very long :(

xldaedalus

Look up Reland Sun 1.3 inch 6PIN SPI Blue White OLED Display Screen Module SH1106 on Amazon.com.uk. I see one listed for 5pounds sterling.  Delivery seems long, but it comes from China.  You may be able to get similar from Farnell already in the UK.  Newark is the same company in the US, and Newark lists the part as

0.96" OLED SSD1306 controller

https://www.newark.com/midas/mdob128064v2v-wi/oled-graphic-display-cob-128x64pixels/dp/21AH3308?st=oled

The data sheet lists a UK company as the importer, you could contact them about something that would suit you.

https://www.farnell.com/datasheets/3120881.pdf

Beware: The SDD1306 controller and the SH1106 controller are NOT the same.  The SH1106 is native 132x64, as I understand it, it only works in "Page memory" mode.  There are some libraries here, but I just downloaded them to try them out.  The SH1106 doesn't require the voltage boost to drive the OLEDs, so the SH1106 can be less expensive, and probably why the 1.3" display has become so common.  And I've seen prices down to $2 ea.  These are nice, but may require some work to get them working efficently.

I'll post my efforts when I get a chance to work on this.

Good luck.
Never, never, never give up

John Drew

#38
I had 4 SSD1306 in operation but even though I was blanking the writing to the screen after 15 minutes of use the OLEDs began to deteriorate and one was almost unreadable with faint digits in some positions.
Maybe I had a bad batch.
John

Dompie

Yes John, I also have such an experience, only this happened to me immediately when using two new ones. It's definitely a quality issue.

Johan