View previous topic :: View next topic |
Author |
Message |
Sabre
Joined: 14 Sep 2007 Posts: 12
|
Posted: Thu Mar 12, 2020 7:17 pm Post subject: Library for a 64x32 0,49" SSD1306 oled display |
|
|
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 |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
Posted: Thu Mar 12, 2020 8:36 pm Post subject: |
|
|
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 |
|
|
Sabre
Joined: 14 Sep 2007 Posts: 12
|
Posted: Thu Mar 12, 2020 8:52 pm Post subject: |
|
|
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 |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Fri Mar 13, 2020 2:49 am Post subject: |
|
|
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 |
|
|
Sabre
Joined: 14 Sep 2007 Posts: 12
|
Posted: Fri Mar 13, 2020 1:17 pm Post subject: |
|
|
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 |
|
|
Sabre
Joined: 14 Sep 2007 Posts: 12
|
Posted: Fri Mar 13, 2020 4:38 pm Post subject: |
|
|
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 |
|
|
Sabre
Joined: 14 Sep 2007 Posts: 12
|
Posted: Fri Mar 13, 2020 6:41 pm Post subject: |
|
|
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 |
|
|
|