PDA

View Full Version : SSD1306 start display problem



harryweb
- 4th December 2016, 17:40
Hi,
I'm trying to use an adafruit 0.96" 128x64 OLED. using SPI
I want to draw some graphics (BIG numbers in this case 30x48 pixels each)
I don't want to draw the entire display (1024 bytes) to place my number at the center (by example) of the screen.
I would like to just send 180 bytes of my little graphic
So I try this code: (part)


zero:

low dc : PAUSEUS 10 'mode command
val = $20 'set mem addr mode
gosub send
val = 1 'mode vertical (with $20 above)
gosub send
val = $22 'setup page start & end addr
gosub send
val = 1 'start page 1 (page 0 not used) High caract = 6 bytes ... 8 possible
gosub send
val = 6 'end page 6 (page 7 not used)
gosub send

val = $21 'set colonne start & end
gosub send
val = 49 'would like to place at the center so at row 49 (start)
gosub send
val = 78 ' end
gosub send

high dc : PAUSEUS 10 'mode display


for tab = 0 to 179
lookup tab,[$00,$00,$FF,$FF,$00,$00,$00,$F8,$FF,$FF,$0F,$00,$0 0,$FF,$FF,$FF,$7F,$00,_
$C0,$FF,$FF,$FF,$FF,$01,$E0,$FF,$FF,$FF,$FF,$03,$F 0,$FF,$FF,$FF,$FF,$07,_
$F8,$FF,$FF,$FF,$FF,$0F,$FC,$FF,$FF,$FF,$FF,$1F,$F E,$FF,$FF,$FF,$FF,$3F,_
$FE,$7F,$00,$00,$FE,$3F,$FE,$07,$00,$00,$F0,$3F,$F F,$01,$00,$00,$C0,$7F,_
$FF,$01,$00,$00,$C0,$7F,$FF,$00,$00,$00,$80,$7F,$F F,$00,$00,$00,$80,$7F,_
$FF,$00,$00,$00,$80,$7F,$FF,$00,$00,$00,$80,$7F,$F F,$01,$00,$00,$C0,$7F,_
$FF,$01,$00,$00,$C0,$7F,$FE,$07,$00,$00,$F0,$3F,$F E,$3F,$00,$00,$FF,$3F,_
$FE,$FF,$FF,$FF,$FF,$3F,$FC,$FF,$FF,$FF,$FF,$1F,$F 8,$FF,$FF,$FF,$FF,$0F,_
$F0,$FF,$FF,$FF,$FF,$07,$E0,$FF,$FF,$FF,$FF,$03,$C 0,$FF,$FF,$FF,$FF,$01,_
$00,$FF,$FF,$FF,$7F,$00,$00,$F8,$FF,$FF,$0F,$00,$0 0,$00,$FF,$7F,$00,$00],val ' Code for char 0

gosub send ' send data

pause 10 ' to see it slowly
next tab
return

but it doesn't start at row 49... Always at ROW 0 !

8357

I tried to see code from others (arduino too but they use libraries so... just crazy) but I can't see what's wrong.
Any help ?
Regards

harryweb
- 14th December 2016, 19:16
OK... I know what's wrong. This is not my code ! It's because of the bad simulation of the SSD1306 with proteus software :-( I took a real 0.96" OLED display and it works fine without any change of my code.