rq3
Senior Member
I've been playing with an Adafruit 128x32 OLED display, and managed to get it to light up and display a test image created from a BMP file in LCDAssistant.
After a lot of struggling and playing with various init parameters, here's the code:
The data sheet for the SSD1306 driver is here:
http://www.adafruit.com/datasheets/SSD1306.pdf
I'm hoping someone can help me with two items:
1) The SSD1306 insists that its initialization be done with i2cword, and it insists that its display RAM be loaded with i2cbyte. Am I configuring the RAM data incorrectly?
2) For the life of me, I can't figure out how to clear the display, short of writing all zeros to the RAM!
I've tried all of the obvious, like running the picaxe clock at the standard (4 MHz) rate with "i2cslow" in the setup. inserting generous pauses, etc.
Any and all comments very welcome!
Thanks, Rip
After a lot of struggling and playing with various init parameters, here's the code:
Code:
#PICAXE 20M2
setfreq M32
dirsC=%11111101 ;make C.1 input(C.1 is decay mode)
outpinsC=%00001000 ;disable the stepper driver and stay here
test:
hi2csetup i2cmaster,%01111000,i2cfast_32,i2cword
hi2cout (0xA8,0x07,0x8d,0x14,0xA1,0xDA,0x02,0xAF) ;initialize display
;#rem
;hi2cout (0xAE) ;turn off display(RESET=OFF)
;hi2cout (0x00) ;low column nibble(RESET=0)
;hi2cout (0x1F) ;high column nibble(RESET=0)
;hi2cout (0x40)
;hi2cout (0xB0) ;start page address(RESET=0)
;hi2cout 0x20,(0x02) ;memory address mode(RESET=02 [page])
;hi2cout 0xD5,(0x80) ;oscillator frequency and divider(RESET=80)00
;hi2cout 0xA8,(0x07) ;mux ratio(RESET=3F [64 lines])
;hi2cout 0xD3,(0x00) ;display offset,COM vertical shift(RESET=0)
;hi2cout 0x8D,(0x14) ;enable charge pump(RESET=10 [OFF])
;hi2cout (0xA1) ;segment remap(RESET=SEG0, COL0) 00 mirror image
;hi2cout (0xC0) ;COM output scan(RESET=C0, C8 flips display)
;hi2cout 0xDA,(0x02) ;COM pins hardware config(RESET=1b[alternate])
;hi2cout 0x81,(0xCF) ;contrast CF(RESET=7F)
;hi2cout 0xD9,(0xF1) ;pre-charge period F1(RESET=22)
;hi2cout 0xDB,(0x30) ;Vcom deselect(RESET=20)
;hi2cout (0xA4) ;turn all on ignore RAM A5/RAM A4(RESET=A4)
;hi2cout (0xA6) ;normal display A6/inverted A7(RESET=A6)
;hi2cout (0xAF) ;turn on display
hi2csetup i2cmaster,%01111000,i2cfast_32,i2cbyte ;load two 8 bit lines
hi2cout 0x40,( _
0x00, 0x00, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, _
0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, _
0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, _
0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, _
0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, _
0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, _
0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, _
0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00)
http://www.adafruit.com/datasheets/SSD1306.pdf
I'm hoping someone can help me with two items:
1) The SSD1306 insists that its initialization be done with i2cword, and it insists that its display RAM be loaded with i2cbyte. Am I configuring the RAM data incorrectly?
2) For the life of me, I can't figure out how to clear the display, short of writing all zeros to the RAM!
I've tried all of the obvious, like running the picaxe clock at the standard (4 MHz) rate with "i2cslow" in the setup. inserting generous pauses, etc.
Any and all comments very welcome!
Thanks, Rip