Hallo Bin am verzweifeln beim Textdarstellen eines Displays von Display 3000. Bekomme die textdarstellung nicht hin. habe aus einen Beispiel folgendes int n6100DrawChar(char c) { uint16_t index; uint8_t i, j, w, data, skipped=1, startY=yCoord; sendCMD(MEM_ACCESS_CTRL); memAccessCtrl |= (0x01 << VERT_WRITE); sendData(memAccessCtrl); if(c == '\n') n6100NewLine(); if(c < 32) return 0; c -= 32; index = c*f.width*(f.height/8); for(w=0; w<f.width; w++) { for(i=0; i<f.height/8; i++) { data = pgm_read_byte(f.charData + index++); for(j=0; j<8; j++) { if(data & 0x01) { if(skipped) { n6100GotoXY(xCoord, yCoord); sendCMD(MEM_WRITE); skipped=0; } n6100DrawPixel(); yCoord++; } else { skipped=1; n6100GotoXY(xCoord, ++yCoord); } data >>= 1; } } n6100GotoXY(++xCoord, startY); } sendCMD(MEM_ACCESS_CTRL); memAccessCtrl &= ~(0x01 << VERT_WRITE); sendData(memAccessCtrl); return 0; } wenn ich als c ='9' schicke dann sieht es aus wie Japanische Schrift. aber nicht wie eine 9 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E, // "9" welchen wert hat data bei data = pgm_read_byte(f.charData + index++); hatt data 01101101???? danke
"0x00, 0x06, 0x49, 0x49, 0x29, 0x1E, // "9"" stammt aus der 6x8 Fonttabelle. Die Werte sind in Binärdarstellung 00000000 00000110 01001001 01001001 00101001 00011110 Rotiert (90° CCW) wegen 6=Breite und 8=Höhe 00###0 0#000# 0#000# 00#### 00000# 0000#0 000#00 000000 Sieht wie eine "9" aus ;-) Schiefgehen könnte die Anzeige im Programm, wenn die Struktur f nicht mit den korrekten Daten über den Font gefüllt ist. D.h. f.width z.B. nicht auf 6 steht... oder die f.chardata nicht auf das Font6x8 Array zeigt. Danach sieht es aber nicht aus, die Initialisierung kommt mir korrekt vor. Ich würde auch Deinen Ansatz verfolgen und an der Stelle "data = pgm_read_byte(f.charData + index++);" kontrollieren, mit was data gefüllt wird. Die Folge 01101101 (0x6D) kommt bei der "9" nicht vor, sie kommt sogar nirgends vor, d.h. möglicherweise zeigt f.chardata nicht auf das Font6x8 Array, oder pgm_read_byte() arbeitet nicht richtig oder index ist falsch berechnet.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.