SSD1306 OLED (72x40) I2C display from scratch


Closed Thread
Results 1 to 40 of 74

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,722


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 OLED (42x40) I2C display from scratch

    yes , aligning the font data packing with the ssd1306's memory page layout is more efficient usage of the 14 bit width of the flash memory
    while it will still need some clever manipulation to unpack it into a 8 bit data stream

    Name:  fonts.jpg
Views: 13123
Size:  209.4 KB
    Warning I'm not a teacher

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default SSD1306 OLED (72x40) I2C display from scratch

    Okay, found!

    Name:  VerticalAddressingMode.png
Views: 13818
Size:  85.7 KB
    Roger

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default SSD1306 OLED (72x40) I2C display from scratch

    Here is a simple code to get started with this 72x40 display.

    I also include the SSD1306 command and display's datasheets.

    Since I use EXCEL to design characters, here's the sheet you may want to have a look at.

    And again, lots of thanks to Richard

    Name:  Display example.png
Views: 16048
Size:  513.8 KB
    Attached Images Attached Images
    Attached Files Attached Files
    Roger

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,722


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 OLED (42x40) I2C display from scratch

    You seem to have the communication to the controller well under control
    next step is to try to store a font economically, you have probably discovered a large font on a very resource limited chip
    like a 690 stored as a series of code structures like
    I2CWrite SDA,SCL,I2CDevice,_
    [$40,192,224,240,248,252,126,63,63,63,63,63,63,63,6 3,126,252,248,240,224,192,_
    255,255,255,255,128,128,128,128,128,128,128,128,12 8,128,128,128,255,255,255,255,_
    255,255,255,255,15,15,15,15,15,15,15,15,15,15,15,1 5,255,255,255,255,_
    255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,25 5,255]
    will by the time you have 10 digits covered will have blown 75% of the chips flash.
    fonts can be stored in much better ways, even expanded out as the are read back
    Warning I'm not a teacher

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default SSD1306 OLED (72x40) I2C display from scratch

    fonts can be stored in much better ways
    Richard, can you point me the direction to do this?

    Should I use some kind of algorithm where repetitive numbers could be stored differently or find a way to make better use of the 14 bits word size of the 16F690?
    Roger

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,722


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 OLED (72x40) I2C display from scratch

    the font is just a simple block of data
    this one is for digits 0 to 9 + "." + "%" its 14 bits high and 10 bits wide [to match chip flash]
    so total size is 120 words
    for convenience lets locate it a the end of flash - 120 words ie. 0xf88
    note this is only partially "filled" in and not very carefully at that

    Code:
    asm       ;incomplete and very rough font 14x10
     org 0xf88
     dw    0x1ffc,0x3ffe,0x3006,0x3006,0x3006,0x3006,0x3006,0x3006,0x3ffe,0x1ffc ;"0"
     dw    0,0x300C,0x300E,0x300F,0x3ffF,0x3ffF,0x3ffF,0x3000,0x3000,0
     dw    0x3806,0x3C07,0x3E03,0x3703,0x3383,0x31E3,0x30F3,0x307F,0x303E,0
     dw    0x3018,0x3006,0x3186,0x3186,0x3186,0x3186,0x3186,0x3006,0x3cf8,0x1ffc  ;"3"
     dw    0,0x3ffe,0,0x3ffe,0,0x3ffe,0,0x3ffe,0,0
     dw    0,0x3ffe,0,0x3ffe,0x3ffe,0x3ffe,0,0x3ffe,0,0
     dw    0x3ffe,0x3ffe,0x3ffe,0,0,0,0,0x3ffe,0x3ffe,0x3ffe
     dw    0x3ffe,0x3ffe,0x3ffe,0,0,0x3ffe,0,0x3ffe,0x3ffe,0x3ffe
     dw    0x1ffc,0x3ffe,0x3186,0x3186,0x3186,0x3186,0x3186,0x3186,0x3ffe,0x1ffc  ;"8"
     dw    0,0x3ffe,0x3ffe,0x3ffe,0x3ffe,0x3ffe,0x3ffe,0x3ffe,0x3ffe,0x3ffe
     dw    0,0,0,0xE00,0x1F00,0x1F00,0xE00,0,0,0    ;"."
     dw    0x181f,0xC11,0x611,0x31f,0x1C0,0x60,0x1F38,0x110c,0x1106,0x1F02  ;"%"
    endasm
    normally i would make the font an include and give it a label rather than manually locate it like this
    dt's macro as found in dt-ints is ideal to find and numerate the font address
    GetAddress macro Label, Wout
    CHK?RP Wout
    movlw low Label ; get low byte
    movwf Wout
    movlw High Label ; get high byte
    movwf Wout + 1
    endm
    when the fonts address is known its simple to use readcode command to retrieve font data
    Last edited by lester; - 8th December 2023 at 08:44. Reason: Changed Thread Title
    Warning I'm not a teacher

  7. #7
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default SSD1306 OLED (72x40) I2C display from scratch - scrolling text

    Just for fun, scrolling text example

    Name:  ScrollingText.png
Views: 16233
Size:  412.8 KB
    Attached Files Attached Files
    Roger

Similar Threads

  1. big char oled display
    By mombasa in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th September 2020, 07:02
  2. SSD1306 start display problem
    By harryweb in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th December 2016, 19:16
  3. Cannot drive I2C Oled :(
    By elcrcp in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 20th August 2016, 12:19
  4. OLED Display Noise problem
    By gunayburak in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 5th July 2016, 10:15
  5. Help With OLED Display / 128X64 SSD1306
    By Denner in forum General
    Replies: 6
    Last Post: - 25th May 2013, 15:40

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts