SSD1306 mit I²C zeigt nur Rauschen

OP #4483105
Lesenswert?

Hallo zusammen, bevor mich das Thema noch 2 Tage kostet:
ich verwende eine PIC und will ein 64x48 Display mit SSD1306 controller 
zum laufen bringen- mit I²C.
Das Problem ist, das Display nimmt die Commandos alle an. Ich kann es 
blinken lassen, ein/auschalten und noch ein paar Sachen.
Aber es nimmt keine Daten an- im Bild sind nur zufällige Pixel zu sehen, 
es ist zum verrückt werden...


void I2CSend (unsigned char dat)
  {
  SSP1BUF = dat;  // Move data to SSPBUF
  while (I2C1_BF);// wait till complete data is sent from buffer
  I2CIdle();  // wait for any pending transfer
  }

void Write_I2C_Data (unsigned char DATA)
  {
  I2CIdle();
  I2CStart();

  I2CSend(0x78);  // Adresse vom Display 7 Bit + WriteBit
  I2CSend(0x40);  //Daten
  I2CSend(DATA);

  I2CStop();
  __delay_us(10);
  }


Write_I2C_Commando(0xB0);
Write_I2C_Commando(0x10);
Write_I2C_Commando(0x05);
Write_I2C_Data(0xFF);
Angehängte Dateien:
OP #4483186
Lesenswert?

Hallo Christian,

Das Display hat Pages von B0 bis B5. (48/8). Die habe ich schon alle 
probiert
Ich verwende den SSD1306 in ner anderen Anwendung mit Parallel- da geht 
alles einwandfrei, und ich glaube mich gut auszukennen mit dem 
Bildschirm.
Aber das I²C geht nicht um viel.
Wie gesagt- der Bus scheint in Ordnung, sonst könnte ich verschieden 
Commandos nicht ausführen.
Irgendwas fehlt noch...
Gast #4483630
Lesenswert?

Es ist ein shell Skript für den Raspberry aber der funktioniert. Da hast 
du schon mal die init Reihenfolge falls es daran liegt. Kann genauso 
auch auf C übertragen werden. Bei mir funktioniert dieser Code.
1
#init
2
i2cset -y 1 0x3c 0x00 0xAE  #Display OFF (sleep mode)
3
sleep 0.1
4
i2cset -y 1 0x3c 0x00 0xA8  #Set Multiplex Ratio
5
i2cset -y 1 0x3c 0x00 0x3F    #value
6
i2cset -y 1 0x3c 0x00 0xD3  #Set Display Offset
7
i2cset -y 1 0x3c 0x00 0x00    #no vertical shift
8
i2cset -y 1 0x3c 0x00 0x40  #Set Display Start Line to 000000b
9
i2cset -y 1 0x3c 0x00 0xA1  #Set Segment Re-map, column address 127 is mapped to SEG0
10
i2cset -y 1 0x3c 0x00 0xC8  #Set COM Output Scan Direction, remapped mode. Scan from COM7 to COM0
11
i2cset -y 1 0x3c 0x00 0xDA  #Set COM Pins Hardware Configuration
12
i2cset -y 1 0x3c 0x00 0x12    #Alternative COM pin configuration, Disable COM Left/Right remap
13
i2cset -y 1 0x3c 0x00 0x81  #Set Contrast Control
14
i2cset -y 1 0x3c 0x00 0xCF    #value, 0x7F max.
15
i2cset -y 1 0x3c 0x00 0xA4  #display RAM content
16
i2cset -y 1 0x3c 0x00 0xA6  #non-inverting display mode
17
i2cset -y 1 0x3c 0x00 0xD5  #Set Display Clock (Divide Ratio/Oscillator Frequency)
18
i2cset -y 1 0x3c 0x00 0x80    #max fequency, no divide ratio
19
i2cset -y 1 0x3c 0x00 0x8D  #Charge Pump Setting
20
i2cset -y 1 0x3c 0x00 0x14    #enable charge pump
21

22
#i2cset -y 1 0x3c 0x00 0x00
23
#i2cset -y 1 0x3c 0x00 0xD9  #Set Pre-charge Period
24
#i2cset -y 1 0x3c 0x00 0xF1    #value
25
#i2cset -y 1 0x3c 0x00 0xDB  #Set V COMH Deselect Level
26
#i2cset -y 1 0x3c 0x00 0x40    #???
27

28
i2cset -y 1 0x3c 0x00 0xAF  #Display ON (normal mode)
29
sleep 0.001

und dann noch clear, da kann man damit auch das Display beschreiben
1
bash init
2
#clear
3
#set cursor to 0 0
4
i2cset -y 1 0x3c 0x00 0x20
5
i2cset -y 1 0x3c 0x00 0x20
6

7
i2cset -y 1 0x3c 0x00 0x21
8
i2cset -y 1 0x3c 0x00 0x00
9
i2cset -y 1 0x3c 0x00 0x7F
10
i2cset -y 1 0x3c 0x00 0x22
11
i2cset -y 1 0x3c 0x00 0x00
12
i2cset -y 1 0x3c 0x00 0x07
13

14
for i in {1..128}
15
do
16
   i2cset -y 1 0x3c 0x40 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 i
17
done

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren