Hallo zusammen,
da ich nach Recherche und Probieren nicht mehr weiterkomme, möchte ich versuchen, auf diesem Weg eine Erklärung oder Lösungsansatz zu erhalten.
Für ein Projekt möchte ich ein 1.8" Display mit SPI-Ansteuerung für die Darstellung sehr großer Textsymbole verwenden.
Da ich bereits die überaus nützliche Bibliothek von HKipnik (ST7735_functions.inc) an anderer Stelle einsetze, nahm ich an, dass es kein Problem sein sollte, nach Erstellung einer Fonts-Datei (~.font) für eine Symbolgröße von etwas 40x64 mit folgender Programmsequenz der Bibliothek (nach Anpassung an den neuen Dateinamen) zugreifen zu können:
'*******************************************************************************
'LCD_Text String -- X -- Y Start -- Font -- Forecolor -- Backcolor
'*******************************************************************************
Sub Lcd_text(byval S As String , Xoffset As Byte , Yoffset As Byte , Fontset As Byte , Forecolor As Word , Backcolor As Word )
Local Tempstring As String * 1 , Temp As Word 'Dim local the variables
Local A As Byte , Pixels As Byte , Count As Byte , Carcount As Byte , Lus As Byte
Local Row As Byte , Block As Byte , Byteseach As Byte , Blocksize As Byte , Dummy As Byte
Local Colums As Byte , Columcount As Byte , Rowcount As Byte , Stringsize As Byte
Local Xpos As Byte , Ypos As Byte , Pixel As Byte , Pixelcount As Byte
Local Offset As Word
Stringsize = Len(s) - 1 'Size of the text string -1 because we must start with 0
Select Case Fontset
Case 1 :
Block = Lookup(0 , Font8x8) 'Add or remove here fontset's that you need or not,
Byteseach = Lookup(1 , Font8x8)
Blocksize = Lookup(2 , Font8x8)
Dummy = Lookup(3 , Font8x8)
Case 2 :
Block = Lookup(0 , Font12x16)
Byteseach = Lookup(1 , Font12x16)
Blocksize = Lookup(2 , Font12x16)
Dummy = Lookup(3 , Font12x16)
'(
Case 3 :
Block = Lookup(0 , Font8x12)
Byteseach = Lookup(1 , Font8x12)
Blocksize = Lookup(2 , Font8x12)
Dummy = Lookup(3 , Font8x12)
Case 4 :
Block = Lookup(0 , Font6x10)
Byteseach = Lookup(1 , Font6x10)
Blocksize = Lookup(2 , Font6x10)
Dummy = Lookup(3 , Font6x10)
Case 5 :
Block = Lookup(0 , Font10x16)
Byteseach = Lookup(1 , Font10x16)
Blocksize = Lookup(2 , Font10x16)
Dummy = Lookup(3 , Font10x16)
')
End Select
Colums = Blocksize / Block 'Calculate the numbers of colums
Row = Block * 8 'Row is always 8 pixels high = 1 byte, so working with row in steps of 8.
Row = Row - 1 'Want to start with row=0 instead of 1
Colums = Colums - 1 'Same for the colums
For Carcount = 0 To Stringsize 'Loop for the numbers of caracters that must be displayed
Temp = Carcount + 1 'Cut the text string in seperate caracters
Tempstring = Mid(s , Temp , 1)
Offset = Asc(tempstring) - 32 'Font files start with caracter 32
Offset = Offset * Blocksize
Offset = Offset + 4
Temp = Carcount * Byteseach
Temp = Temp + Xoffset
For Rowcount = 0 To Row Step 8 'Loop for numbers of rows
A = Rowcount + Yoffset
Xpos = Temp
For Columcount = 0 To Colums 'Loop for numbers of Colums
Select Case Fontset
Case 1 : Pixels = Lookup(offset , Font8x8)
Case 2 : Pixels = Lookup(offset , Font12x16)
' Case 3 : Pixels = Lookup(offset , Font8x12)
' Case 4 : Pixels = Lookup(offset , Font6x10 )
' Case 5 : Pixels = Lookup(offset , Font10x16 )
End Select
Ypos = A
For Pixelcount = 0 To 7 'Loop for 8 pixels to be set or not
Pixel = Pixels.0 'Set the pixel (or not)
If Pixel = 1 Then
Call Lcd_set_pixel(xpos , Ypos , Forecolor)
Else
If Backcolor <> Transparent Then
Call Lcd_set_pixel(xpos , Ypos , Backcolor)
End If
End If
Shift Pixels , Right 'Shift the byte 1 bit to the right so the next pixel comes availible
Incr Ypos 'Each pixel on his own spot
Next Pixelcount
Incr Offset
Incr Xpos 'Do some calculation to get the caracter on the correct Xposition
Next Columcount
Next Rowcount
Next Carcount
End Sub
Leider erfolgslos! Zunächst vermutete ich die Fehlerursache in der Kodierung der Fonts-Datei, aber mit keinem der drei eingesetzten Editoren konnte eine funktionsfähige erzeugt werden.
Beispielsweise konnten folgende Daten problemlos zur Anzeige gebracht werden:
Digital20x32:
$asm
.db 4,20,80,0
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;
.db 0,0,0,0,0,0,
...
$end asm
Allerdings ist mir die Darstellung noch zu klein.
Bei weiteren Versuchen stellte sich heraus - egal, welchen installierten Font man als "Ausgangsmaterial" einsetzt - dass ab etwas einer Fontbreite von 40 mit der Routine Sub Lcd_text(...) keine Symbolanzeigen möglich sind; stets ist ein waagerechtes oder senkrechtes "Pixelrauschen" das Ergebnis.
Beim nächsten Versuch habe ich eine (gekürzte) Fontdatei 48.zip aus einer Sammlung eingesetzt; auch hier keine korrekte Anzeige.
Zunächst vermutete ich, dass die Variablen-Deklarationen für die Datenmenge nicht ausreicht, aber auch mit einer Änderung hatte ich keinen Erfolg.
Kennt vielleicht jemand die Ursache und hat eine Lösung für das Problem?
Gruß Ingolf
da ich nach Recherche und Probieren nicht mehr weiterkomme, möchte ich versuchen, auf diesem Weg eine Erklärung oder Lösungsansatz zu erhalten.
Für ein Projekt möchte ich ein 1.8" Display mit SPI-Ansteuerung für die Darstellung sehr großer Textsymbole verwenden.
Da ich bereits die überaus nützliche Bibliothek von HKipnik (ST7735_functions.inc) an anderer Stelle einsetze, nahm ich an, dass es kein Problem sein sollte, nach Erstellung einer Fonts-Datei (~.font) für eine Symbolgröße von etwas 40x64 mit folgender Programmsequenz der Bibliothek (nach Anpassung an den neuen Dateinamen) zugreifen zu können:
'*******************************************************************************
'LCD_Text String -- X -- Y Start -- Font -- Forecolor -- Backcolor
'*******************************************************************************
Sub Lcd_text(byval S As String , Xoffset As Byte , Yoffset As Byte , Fontset As Byte , Forecolor As Word , Backcolor As Word )
Local Tempstring As String * 1 , Temp As Word 'Dim local the variables
Local A As Byte , Pixels As Byte , Count As Byte , Carcount As Byte , Lus As Byte
Local Row As Byte , Block As Byte , Byteseach As Byte , Blocksize As Byte , Dummy As Byte
Local Colums As Byte , Columcount As Byte , Rowcount As Byte , Stringsize As Byte
Local Xpos As Byte , Ypos As Byte , Pixel As Byte , Pixelcount As Byte
Local Offset As Word
Stringsize = Len(s) - 1 'Size of the text string -1 because we must start with 0
Select Case Fontset
Case 1 :
Block = Lookup(0 , Font8x8) 'Add or remove here fontset's that you need or not,
Byteseach = Lookup(1 , Font8x8)
Blocksize = Lookup(2 , Font8x8)
Dummy = Lookup(3 , Font8x8)
Case 2 :
Block = Lookup(0 , Font12x16)
Byteseach = Lookup(1 , Font12x16)
Blocksize = Lookup(2 , Font12x16)
Dummy = Lookup(3 , Font12x16)
'(
Case 3 :
Block = Lookup(0 , Font8x12)
Byteseach = Lookup(1 , Font8x12)
Blocksize = Lookup(2 , Font8x12)
Dummy = Lookup(3 , Font8x12)
Case 4 :
Block = Lookup(0 , Font6x10)
Byteseach = Lookup(1 , Font6x10)
Blocksize = Lookup(2 , Font6x10)
Dummy = Lookup(3 , Font6x10)
Case 5 :
Block = Lookup(0 , Font10x16)
Byteseach = Lookup(1 , Font10x16)
Blocksize = Lookup(2 , Font10x16)
Dummy = Lookup(3 , Font10x16)
')
End Select
Colums = Blocksize / Block 'Calculate the numbers of colums
Row = Block * 8 'Row is always 8 pixels high = 1 byte, so working with row in steps of 8.
Row = Row - 1 'Want to start with row=0 instead of 1
Colums = Colums - 1 'Same for the colums
For Carcount = 0 To Stringsize 'Loop for the numbers of caracters that must be displayed
Temp = Carcount + 1 'Cut the text string in seperate caracters
Tempstring = Mid(s , Temp , 1)
Offset = Asc(tempstring) - 32 'Font files start with caracter 32
Offset = Offset * Blocksize
Offset = Offset + 4
Temp = Carcount * Byteseach
Temp = Temp + Xoffset
For Rowcount = 0 To Row Step 8 'Loop for numbers of rows
A = Rowcount + Yoffset
Xpos = Temp
For Columcount = 0 To Colums 'Loop for numbers of Colums
Select Case Fontset
Case 1 : Pixels = Lookup(offset , Font8x8)
Case 2 : Pixels = Lookup(offset , Font12x16)
' Case 3 : Pixels = Lookup(offset , Font8x12)
' Case 4 : Pixels = Lookup(offset , Font6x10 )
' Case 5 : Pixels = Lookup(offset , Font10x16 )
End Select
Ypos = A
For Pixelcount = 0 To 7 'Loop for 8 pixels to be set or not
Pixel = Pixels.0 'Set the pixel (or not)
If Pixel = 1 Then
Call Lcd_set_pixel(xpos , Ypos , Forecolor)
Else
If Backcolor <> Transparent Then
Call Lcd_set_pixel(xpos , Ypos , Backcolor)
End If
End If
Shift Pixels , Right 'Shift the byte 1 bit to the right so the next pixel comes availible
Incr Ypos 'Each pixel on his own spot
Next Pixelcount
Incr Offset
Incr Xpos 'Do some calculation to get the caracter on the correct Xposition
Next Columcount
Next Rowcount
Next Carcount
End Sub
Leider erfolgslos! Zunächst vermutete ich die Fehlerursache in der Kodierung der Fonts-Datei, aber mit keinem der drei eingesetzten Editoren konnte eine funktionsfähige erzeugt werden.
Beispielsweise konnten folgende Daten problemlos zur Anzeige gebracht werden:
Digital20x32:
$asm
.db 4,20,80,0
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;
.db 0,0,0,0,0,0,
...
$end asm
Allerdings ist mir die Darstellung noch zu klein.
Bei weiteren Versuchen stellte sich heraus - egal, welchen installierten Font man als "Ausgangsmaterial" einsetzt - dass ab etwas einer Fontbreite von 40 mit der Routine Sub Lcd_text(...) keine Symbolanzeigen möglich sind; stets ist ein waagerechtes oder senkrechtes "Pixelrauschen" das Ergebnis.
Beim nächsten Versuch habe ich eine (gekürzte) Fontdatei 48.zip aus einer Sammlung eingesetzt; auch hier keine korrekte Anzeige.
Zunächst vermutete ich, dass die Variablen-Deklarationen für die Datenmenge nicht ausreicht, aber auch mit einer Änderung hatte ich keinen Erfolg.
Kennt vielleicht jemand die Ursache und hat eine Lösung für das Problem?
Gruß Ingolf