Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Issue with glcdSSD1306-I2C-Buf.lib

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

Bascom Member



Joined: 13 Dec 2017
Posts: 19

PostPosted: Sun Dec 01, 2019 5:43 pm    Post subject: Issue with glcdSSD1306-I2C-Buf.lib Reply with quote

I have been using the glcdSSD1306-I2C-Buf buffered library for SSD1306 OLED screens. I have 2 units that have the .96" oled that I wanted to use this code with. On one of the screens, I have no issues. The library drives the screen perfectly and the buffer is super fast. However on another SSD1306 .96" OLED, there appears to be a strange issue. When I run the test program for the glcdSSD1306-I2C-Buf library, the image is shifted up by 8 pixels whenever one of the graphics commands (LINE, BOX, PSET etc) is used. If I print a line of text using lcdat 1,0 , "EXAMPLE" BEFORE I call one of the graphics commands, then the text appears in the correct place. However, once I call a graphics command, the text shift up by about 8 pixels and the top 8 pixels of the screen get chopped off. I have tried altering the library in every way I can think of according to the data sheet, but to no avail. I also noticed that when I type CLS, that the bottom 8 lines of the screen never get cleared. It seems to write the graphics intended for PAGE 7 where PAGE6 would be, thus entirely chopping off PAGE 0. So to sum it up, text will appear in the correct spot, as long as no graphics are being called. The second I call a graphics command, all text shifts up by about 8 px, and the graphics get drawn shifted 8 pixels up, with the bottom row of 8 pixels getting no updates on the screen.

It appears that with the one OLED screen, the contents of the 1024 byte buffer are shifted up a row. This means that when I update the screen using the buffer, including when I clear the screen, only the top 56 rows of pixels get updated, with the top 8 pixels getting cut off. If I write a line of text in the bottom row of the screen (without a graphics command that uses the buffer being called) the text will apper in the correct place, however when I clear the screen, the bottom row of 8 pixels doesn't get cleared.

Any insights or help would be appreciated. Thanks!

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

Bascom Member



Joined: 22 Jun 2004
Posts: 1198
Location: France

france.gif
PostPosted: Mon Dec 02, 2019 10:26 am    Post subject: Reply with quote

Quote:
I have 2 units that have the .96" oled that I wanted to use this code with. On one of the screens, I have no issues.

why want to change the Bascom library since one of them works correctly ?
I think it's a hardware/software problem on the second one.

I use it too without any problem




JP Wink
[/img]

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
Yokablasta

Bascom Member



Joined: 13 Dec 2017
Posts: 19

PostPosted: Mon Dec 02, 2019 4:52 pm    Post subject: Reply with quote

I only want to figure out how to make the other screen work, because I have units in the field that also use that screen. I'm trying to add a firmware update to my units that allows for better graphics, so had switched SSD1306 libs to do it. The old library worked perfectly on all of my products. The new buffered driver has an issue with the screen used on one, so I'm pretty motivated to figure it out.

I did make more progress on this though. It appears that the translation of the software buffer (1024 bytes in sram) and GDDRAM in the display is offset by a certain amount. I'm just looking at the assembly to figure out how to adjust that so I can properly plot the GDDRAM points and display them. When I use text with AUTO mode, wverything works fine. It's when I need to use the buffer that the offset happens. If I figure it out, I'll post here.
Back to top
View user's profile
Yokablasta

Bascom Member



Joined: 13 Dec 2017
Posts: 19

PostPosted: Tue Dec 03, 2019 10:06 pm    Post subject: Reply with quote

I did end up figuring this out. I had to adjust the SETSTARTLINE parameter in the OLED library. One helpful hint for anybody making adjustments to the library, is to be sure to cycle power, not just RESET, when you are making adjustments to the library. Otherwise, an old variable value may linger, causing results to appear differently than they will upon a power cycle. Setting the new start position in the buffer solved my issue.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6198
Location: Holland

blank.gif
PostPosted: Wed Dec 04, 2019 9:48 pm    Post subject: Reply with quote

i assume you altered this value : .db &H40, &H8D ; SETSTARTLINE , CHARGEPUMP
what was the new value for &H40 ?

odd : why would it work different for your other display? 2 of the same lcd should behave exact the same.
altering software is only required when the lcd are not really identical.

_________________
Mark
Back to top
View user's profile Visit poster's website
Yokablasta

Bascom Member



Joined: 13 Dec 2017
Posts: 19

PostPosted: Tue Dec 10, 2019 11:49 am    Post subject: Reply with quote

The two displays were not exactly identical. They were both .96" SSD1306 types, but from different vendors. These were the settings that worked.

.db &H78, &HAE ; DISPLAY OFF
.db &HD5, &H80 ; SET DISPLAY CLOCK DIVISION
.db &H00, &H3F ; SETMULTIPLEX , 128x32
.db &HD3, &H00 ; SET DISPLAY OFFSET , 00
.db &H12 ; Setstartline
.db &H20, &H00 ; DISPLAY MODE
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