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?