Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Library for a 64x32 0,49" SSD1306 oled display

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
Sabre

Bascom Member



Joined: 14 Sep 2007
Posts: 13

poland.gif
PostPosted: Thu Mar 12, 2020 7:17 pm    Post subject: Library for a 64x32 0,49" SSD1306 oled display Reply with quote

I am looking for a I2C library for a 64x32 0,49" oled display with SSD1306 driver chip. I tried unsuccessfully to start the display in the Bascom. Does anyone have a working I2C library for it?

(BASCOM-AVR version : 2.0.8.2 )
Back to top
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2165

netherlands.gif
PostPosted: Thu Mar 12, 2020 8:36 pm    Post subject: Reply with quote

Hi,
Did you used the search button?
There are various library's around and some fixes for existing library's

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
Sabre

Bascom Member



Joined: 14 Sep 2007
Posts: 13

poland.gif
PostPosted: Thu Mar 12, 2020 8:52 pm    Post subject: Reply with quote

Yes, I was looking. None of the libraries refer to such a display. Those available for the SSD1306 driver only support higher resolutions. The display was working on them, but the display was incorrect. As if the first 64 columns were missing.
I also tried to edit the library to use the correct data to initialize the display. I do not know it and the display did not work at all after such an edition.
Back to top
View user's profile
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 338
Location: Japan

japan.gif
PostPosted: Fri Mar 13, 2020 2:49 am    Post subject: Reply with quote

The SSD1306 has a 128x64 dot memory space, so I think your LCD has an address connected to one of its four areas.

Please adjust the offset with the following [_glocate:] of SSD1306 library.

_glocate:
Dec r20 ; adjust
Ldi R17,64 ; Column offset [0-64]
Add R20,R17
Dec r21 ; adjust
Ldi R17,0 ; Row offset [0-4]
Add R21,R17
_setcol:
Back to top
View user's profile Visit poster's website
Sabre

Bascom Member



Joined: 14 Sep 2007
Posts: 13

poland.gif
PostPosted: Fri Mar 13, 2020 1:17 pm    Post subject: Reply with quote

For a display that previously worked correctly (128x32), the displayed image shifted to the right by 64 columns. For this display the image has also shifted but there is something wrong because the image is displayed as if only in the lower right corner. There seems to be a problem with the initialization of the display. Additionally, it displays only on every second line.
I will try to rewrite the display initialization from the documentation I found on the internet. So that I don't have to use a library that doesn't work in this case.

I was able to start the display with such initialization written in the code:
Code:
   I2cstart

    I2cwbyte &HAE                                       '
    I2cwbyte &H00                                       '
    I2cwbyte &H12                                       '
    I2cwbyte &H00                                       '
    I2cwbyte &HB0                                       '
    I2cwbyte &H81                                       '
    I2cwbyte &H4F

    I2cwbyte &HA1                                       '
    I2cwbyte &HA6                                       '
    I2cwbyte &HA8                                       '
    I2cwbyte &H1F                                       '
    I2cwbyte &HC8                                       '
    I2cwbyte &HD3                                       '
    I2cwbyte &H00                                       '

    I2cwbyte &HD5                                       '
    I2cwbyte &H80                                       '
    I2cwbyte &HD9                                       '
    I2cwbyte &H1F                                   '
    I2cwbyte &HDA                                       '
    I2cwbyte &H12                                       '
    I2cwbyte &HDB                                       '

    I2cwbyte &H40
    I2cwbyte &H8D                                       '
    I2cwbyte &H10                                       '

    I2cwbyte &HAF
I2cstop
waitms 100
End Sub


Nevertheless, I still have problems displaying text. I need to add 3 spaces at the beginning of the text to display it correctly. I would like to make changes to the library to create my own library for this display but I don't know if it will work.
Back to top
View user's profile
Sabre

Bascom Member



Joined: 14 Sep 2007
Posts: 13

poland.gif
PostPosted: Fri Mar 13, 2020 4:38 pm    Post subject: Reply with quote

Something is wrong with this code, it does not always work, as if something was missing in the initialization of the display. I rewrote the initialization from the documentation I found. The display works only if I upload the code with another initialization before loading this code.
I give up, I am overwhelmed by correcting these libraries and this code.

I found a video showing the mapping of this display in the memory of the SSD1306 controller:
https://www.youtube.com/watch?v=VTSgDLIUP0A
Back to top
View user's profile
Sabre

Bascom Member



Joined: 14 Sep 2007
Posts: 13

poland.gif
PostPosted: Fri Mar 13, 2020 6:41 pm    Post subject: Reply with quote

Using the code found somewhere in the depths of the internet in combination with the initialization code from the documentation, I was able to finally activate the display enough to show the effects of my work:


It could use somebody to make it a working library.

Sorry for the posts below posts, but the edition does not provide a notification to those interested.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum