SSD1306 Oled

  • 1
  • 2
  • 3
  • 4
  • Page 4 of 4
Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2093
Registered: 03 / 2003
Subject:

Re: SSD1306 Oled

 · 
Posted: 02.06.2015 - 09:43  ·  #25
Hi Frank,

hast du das Init vielleicht auch noch ? ;)

Gruss
Harry
TheBeginner
Schreiberling
Avatar
Gender: n/a
Location: Wunsiedel Bayern
Age: 67
Posts: 756
Registered: 06 / 2013
Subject:

Re: SSD1306 Oled

 · 
Posted: 02.06.2015 - 13:02  ·  #26
Hallo Harry, hatte ich auch mit gepostet, aber für dich noma extra hier :3some:



//------------------------------------------------------------------------------
// // 0111100 = $3C I2C Adresse
//------------------------------------------------------------------------------
Procedure Init_OLED;
var x : byte;
Begin
if I2Cstat($3C) then
// Init sequence for 128x64 OLED module
ssd1306_command(SSD1306_DISPLAYOFF); // 0xAE
ssd1306_command(SSD1306_SETDISPLAYCLOCKDIV); // 0xD5
ssd1306_command($80); // the suggested ratio 0x80
// Multiplex Ratio
ssd1306_command(SSD1306_SETMULTIPLEX); // 0xA8
ssd1306_command($3F); // alt 3F
// Display Offset
ssd1306_command(SSD1306_SETDISPLAYOFFSET); // 0xD3
ssd1306_command($0); // no offset
//Display Startline
ssd1306_command(SSD1306_SETSTARTLINE); // $40
// Set Charge Pump
ssd1306_command(SSD1306_CHARGEPUMP); // 0x8D
ssd1306_command($14);
// Re-map
ssd1306_command(SSD1306_SEGREMAP); // A1
// COM Output Scan Direction
ssd1306_command(SSD1306_COMSCANDEC); // C8

// COM Pins Hardware Configuration
ssd1306_command(SSD1306_SETCOMPINS); // 0xDA
ssd1306_command($12);
// Contrast Control Register
ssd1306_command(SSD1306_SETCONTRAST); // 0x81 Contrast
ssd1306_command($CF);
// Set Pre Charge Period
ssd1306_command(SSD1306_SETPRECHARGE); // 0xd9
ssd1306_command($F1); // alt 22 // $22 - External, $F1 - Internal
// Set VCOMH Deselect level
ssd1306_command(SSD1306_SETVCOMDETECT); // 0xDB
ssd1306_command($40); // $40 $20
// Display OFF
ssd1306_command(SSD1306_DISPLAYALLON_RESUME); // 0xA4
ssd1306_command(SSD1306_NORMALDISPLAY); // 0xA6
//--turn on oled panel
ssd1306_command(SSD1306_DISPLAYON); // 0xAF
endif;
end Init_OLED;
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: SSD1306 Oled

 · 
Posted: 02.06.2015 - 13:34  ·  #27
Hallo Frank,

wie wäre es das ganze Projekt bzw. die Source im Forum unter
"Software" einzustellen? Dann wäre es in Zukunft leichter zu finden.

rolf
TheBeginner
Schreiberling
Avatar
Gender: n/a
Location: Wunsiedel Bayern
Age: 67
Posts: 756
Registered: 06 / 2013
Subject:

Re: SSD1306 Oled

 · 
Posted: 02.06.2015 - 15:00  ·  #28
Hallo Rolf, wenn ich das darf, dann mache ich das gerne, auch mal für andere die sich
gerade damit rumschlagen, weil bei mir gehts super.
Aber wie gesagt der eine oder andere würde das vllt bissel besser machen, sollen sie doch
den Code für ihre zwecke benutzen. :3some:


PS. Mache ich heute abend fertig,
im mom habe ich ein Persönlichen Kampf mit dem Herrn David Bresenham.
Aber den Kampf werde ich gewinnen :angel11: Bin schon in Runde 9 angekommen,
nur noch bissel im Kreis drehen :-)


Gruß Frank
Harald_K
 
Avatar
 
Subject:

Re: SSD1306 Oled

 · 
Posted: 02.06.2015 - 20:57  ·  #29
Bresenham ....

hier mal ein Line aus nem uralten Programm zum automatischen Erzeugen einer techn. Zeichnung eines Gleitlagers .. ist noch DOS, läuft aber auch unter win.

PROCEDURE line_abs( x1,y1,x2,y2 : Integer);
VAR x,y,z,dx,dy,dz,i1,i2 : Integer;
BEGIN
dx := abs(x1-x2);
dy := abs(y1-y2);
IF x1<x2
THEN BEGIN
x := x1;
y := y1;
IF y1>y2 THEN z:= -1 ELSE z := 1;
END
ELSE BEGIN
x := x2;
y := y2;
IF y2>y1 THEN z := -1 ELSE z := 1;
END;
IF dx>dy THEN i2 := dx ELSE i2 := dy;
dz := i2 DIV 2;
setpixel(x,y);
FOR i1 := 1 TO i2
DO BEGIN
IF dz<dx
THEN BEGIN;
dz := dz + dy;
x := x + 1;
END;
IF dz>=dx
THEN BEGIN
dz := dz - dx;
y := y + z;
END;
setpixel(x,y);
END;
END;
TheBeginner
Schreiberling
Avatar
Gender: n/a
Location: Wunsiedel Bayern
Age: 67
Posts: 756
Registered: 06 / 2013
Subject:

Re: SSD1306 Oled

 · 
Posted: 02.06.2015 - 21:12  ·  #30
Ich Danke dir Harald,
Linien sind nicht das Problem, das habe ich schon alles drin, in allen Oktanten.
Kreis habe ich auch soweit, nur bei Ellipse haut es mir die Gehirnzellen wech 😠


Gruß Frank
  • 1
  • 2
  • 3
  • 4
  • Page 4 of 4
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   109   123 · Page-Gen-Time: 0.024894s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI