Menu

OLED GLCD display driver - SSD1306

Anobium
2015-05-26
2016-01-01
  • Anobium

    Anobium - 2015-05-26

    Just released a OLED GLCD display driver using the SSD1306. This is an I2C device.

    The revised GLCD.h driver for the OLED GLCD SSD1306 has full support for load BMP's, text (all pixels addressable) , line, box, circle etc. This supports the full range of GLCD commands.

    This display DOES require RAM of 1024 bytes for the display buffer. 16f devices or AVR or 18F. The driver uses display map hence the need for the RAM.

    If have the code available - please request. I release the driver with the next Hot Release. Demonstration code is also available.

    Anobium

     
    • Anobium

      Anobium - 2015-05-26

      Youtube.

      For a OLED GLCD SSD1306 demonstration see here

       
  • Anobium

    Anobium - 2015-06-02

    Just posted new driver(s) and demonstration code.

    See code repository if cannot wait for the next Hot Release

    added /GCBASIC/trunk/include/glcd_SSD1306.h
    changed /GCBASIC/trunk/include/glcd.h

     
  • viscomjim

    viscomjim - 2015-06-15

    This is most excellent. You never cease to amaze Anobium!!!!!

     
    • Anobium

      Anobium - 2015-06-15

      Let me know if there are any uaeability issues. The driver should be stable.

      And, thank you.

       
  • Peter

    Peter - 2015-12-26

    I ordered an SSD1306 based OLED display and it arrived the other day.

    I've downloaded the files, but when I compile I get an error:

    Error: The array SSD1306_BUFFERALIAS is too large
    

    I'm using a PIC 16F1847 which has 1024 bytes of RAM. Am I doing something wrong?

    The test code is below:

    ~~~~
    ;Chip Settings

    chip 16F1847,32

    include <glcd.h>

    ;Defines (Constants)

    define I2C_DATA PORTB.4

    define I2C_CLOCK PORTB.5

    define GLCD_TYPE GLCD_TYPE_SSD1306

    define GLCD_I2C_Address 0x78

    define I2C_DISABLE_INTERRUPTS ON

    Repeat 10
    PulseOut PORTA.4, 50 ms
    Wait 150 ms
    End Repeat

    GLCDPrint (0, 0, "Great Cow Basic")
    GLCDPrint (0, 8, "Anobium 2015")
    Circle ( 64, 32, 10 )
    ~~~~

     
  • Peter

    Peter - 2015-12-26

    If I change the chip for a 16F1789, it compiles but says 1117 bytes of RAM are needed:

      7.3  Sec.    Program Memory: 1816/16384 words (11.08%)    RAM: 1117/2048 bytes (54.54%)
    

    Do you need more than 1024 bytes RAM for GLCD to work?

     
    • Peter

      Peter - 2015-12-26

      I've managed to solve this by myself :)

      If you have a 128x128 display then you need to buffer the 128 x 128 = 1024 bytes in addition to the RAM that your code needs.
      If you have a smaller display (I have the 128 x 64 display) you can reduce the size of the buffer by editing glcd_SSD1306.h as follows:

      1: Search for:

      If ChipRAM > 1024  Then
          Dim SSD1306_BufferAlias(1024)
      End if
      

      and change to:

      If ChipRAM > XXXX  Then
          Dim SSD1306_BufferAlias(XXXX)
      End if
      

      Where XXXX = Rows x Columns (i.e. 128 x 64 = 768)

      2: Search for:

      For SSD1306_BufferLocationCalc = 1 to 1024
          SSD1306_BufferAlias(SSD1306_BufferLocationCalc) = 0
      Next
      

      and change to:

      For SSD1306_BufferLocationCalc = 1 to XXXX
          SSD1306_BufferAlias(SSD1306_BufferLocationCalc) = 0
      Next
      

      Again, XXXX = Rows x Columns (i.e. 128 x 64 = 768)

      Would it be possible to include something in a future release where you can optionally set the display size and reduce RAM requirements? Something like

      #define GLCD_Rows 64
      #define GLCD_Columns 128
      

      or similar?

       
  • Anobium

    Anobium - 2015-12-26

    Nice mod but I am totally puzzled. I am not doubtīng it works but let me clarify the memory requirement. A display, of this type requires buffered memory, and i assummed a display was 128 * 64. Therefore, for this mono display, 128 * 64 / 8 = 1024 bytes. Why? 128 * 64 pixels is 8192 and we can store 8 pixels per byte, hence the division by 8. So, need 1024 bytes.

    What is the spec of your display?

     

    Last edit: Anobium 2015-12-26
  • Peter

    Peter - 2015-12-27

    Sorry, my bad. I got 128 * 6 = 768 (not 128 * 64) so you're correct it does need 1024 bytes for a 128 x 64 display like the one I have.

    I've done some more testing and while 768 bytes allows you to run the simple demo code, you seem to be limited to the top part of the screen only (row 48 prints, 49-55 do not, 56 prints, 57-63 do not).
    Increasing the buffer size to 896 bytes lets you use more of the display, but rows 57-63 do not print.

    https://www.youtube.com/embed/O_XAXXV0LPk

    So you can get a display working on a low memory device, but you can't use all of the pixels.

     

    Last edit: Peter 2015-12-27
  • Anobium

    Anobium - 2015-12-27

    The display requires 1024 bytes of RAM. I cannot change this. See google

    By reducing the memory you are limiting the display buffer. You really need a device with more RAM.

    Sorry.

     
    • Peter

      Peter - 2016-01-01

      Don't worry, a limited display is more use to me than no display for these low RAM devices. I just wish Microchip produced low pin count devices with higher RAM.

       

Log in to post a comment.