Cannot drive I2C Oled :(


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Boston MA
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Cannot drive I2C Oled :(

    The INIT routine is critical and no single INIT routine will work for all SSD1306 displays. If you get your display to work in under an hour consider yourself lucky. This INIT routine can replace the one from elcrcp above if your display did not work. I have tried this same "routine" for both PIC's, AVR's and in Basic and C.
    Regards
    TimC



    Code:
    '==================    SSD1306 I2C OLED initialization   ======================
    INIT:
    I2CWrite SDA,SCL,I2CDevice,[DC,$AE]'Display OFF
    I2CWrite SDA,SCL,I2CDevice,[DC,$D3,$00]' Set offset to 0
    'I2CWrite SDA,SCL,I2CDevice,[DC,$40]' Set display start line 0, usually not needed
    I2CWrite SDA,SCL,I2CDevice,[DC,$8D,$14]' Set Charge Pump Internal, USUALLY needed
    I2CWrite SDA,SCL,I2CDevice,[DC,$20,$10]' Adressing mode $10=Page, $00=Horizontal
    I2CWrite SDA,SCL,I2CDevice,[DC,$A1]' set segment remap column 127 as start
    i2cwrite sda,scl,I2CDevice,[DC,$C8]' Com Scan Direction, Flip display vertically
    i2cwrite sda,scl,I2CDevice,[DC,$DA,$12]' set COM pins = 128x64=$12   128x32=$02
    I2CWrite SDA,SCL,I2CDevice,[DC,$81,$7F]' Set contrast to $01 to $FF  ($7F is default, $01 is faint)
    I2CWrite SDA,SCL,I2CDevice,[DC,$A4]' display ON continue
    I2CWrite SDA,SCL,I2CDevice,[DC,$A6]' $A6=NORMAL MODE;  $A7=INVERSE MODE
    I2CWrite SDA,SCL,I2CDevice,[DC,$AF]'Display ON
    ' longer delay here because we need to see if display shows random bytes.
    ' If you see random bytes - your display and INIT are probably working!
    pause 500	' remove when you like
    Wait what's DC? Well it should be $00 but I have read it might be $80. Is this why they are only $4 on EBAY?

  2. #2
    Join Date
    Apr 2013
    Posts
    32


    Did you find this post helpful? Yes | No

    Default Re: Cannot drive I2C Oled :(

    Good question there timc
    I realised that I forgot setting DC in init after some time.
    Funny Fact: After I set DC to $80 for INIT routine, oled not worked properly (or maybe not worked at all, can't remember right now) while SET_XY routine working fine with DC $80. So actually I'm not sure if command mode is 00 or 80 but it's working this way

Similar Threads

  1. OLED 128X96 cheap china lcd
    By starwick in forum Code Examples
    Replies: 10
    Last Post: - 19th June 2017, 05:23
  2. Help With OLED Display / 128X64 SSD1306
    By Denner in forum General
    Replies: 6
    Last Post: - 25th May 2013, 15:40
  3. SEROUT + SERIN, OLED + PICAXE coding help required
    By SeanHowson in forum mel PIC BASIC
    Replies: 4
    Last Post: - 15th October 2012, 16:11
  4. Master SPI interface to LCD/OLED??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th September 2009, 23:44
  5. OLED 128x128 color display
    By Ron Marcus in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 21st May 2007, 01:45

Members who have read this thread : 3

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

Tags for this Thread

Posting Permissions

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